class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface

Guesses the MIME type using the PECL extension FileInfo.

Methods

__construct(string $magicFile = null)

No description

bool
isGuesserSupported()

Returns true if this guesser is supported.

string|null
guessMimeType(string $path)

Guesses the MIME type of the file with the given path.

Details

at line 33
__construct(string $magicFile = null)

Parameters

string $magicFile A magic file to use with the finfo instance

See also

http://www.php.net/manual/en/function.finfo-open.php

at line 41
bool isGuesserSupported()

Returns true if this guesser is supported.

Return Value

bool

at line 49
string|null guessMimeType(string $path)

Guesses the MIME type of the file with the given path.

Parameters

string $path The path to the file

Return Value

string|null The MIME type or null, if none could be guessed

Exceptions

LogicException If the guesser is not supported
InvalidArgumentException If the file does not exist or is not readable