guesser
class guesser
Constants
PRIORITY_DEFAULT |
|
Properties
protected array | $guessers |
Methods
Construct a mimetype guesser object
Register MimeTypeGuessers and sort them by priority
Sort the priority of supplied guessers This is a compare function for usort. A guesser with higher priority should be used first and vice versa. usort() orders the array values from low to high depending on what the comparison function returns to it. Return value should be smaller than 0 if value a is smaller than value b. This has been reversed in the comparison function in order to sort the guessers from high to low.
Guess mimetype of supplied file
Choose the best mime type based on the current mime type and the guess If a guesser returns nulls or application/octet-stream, we will keep the current guess. Guesses with a slash inside them will be favored over already existing ones. However, any guess that will pass the first check will always overwrite the default application/octet-stream.
Details
at line 33
__construct(array $mimetype_guessers)
Construct a mimetype guesser object
at line 46
protected
register_guessers(array $mimetype_guessers)
Register MimeTypeGuessers and sort them by priority
at line 90
int
sort_priority(object $guesser_a, object $guesser_b)
Sort the priority of supplied guessers This is a compare function for usort. A guesser with higher priority should be used first and vice versa. usort() orders the array values from low to high depending on what the comparison function returns to it. Return value should be smaller than 0 if value a is smaller than value b. This has been reversed in the comparison function in order to sort the guessers from high to low.
Method has been set to public in order to allow proper testing.
at line 106
string
guess(string $file, string $file_name = '')
Guess mimetype of supplied file
at line 142
string
choose_mime_type(string $mime_type, string $guess)
Choose the best mime type based on the current mime type and the guess If a guesser returns nulls or application/octet-stream, we will keep the current guess. Guesses with a slash inside them will be favored over already existing ones. However, any guess that will pass the first check will always overwrite the default application/octet-stream.