* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\File\MimeType; use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; /** * Guesses the mime type using the PECL extension FileInfo. * * @author Bernhard Schussek */ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface { private $magicFile; /** * @param string $magicFile A magic file to use with the finfo instance * * @see http://www.php.net/manual/en/function.finfo-open.php */ public function __construct($magicFile = null) { $this->magicFile = $magicFile; } /** * Returns whether this guesser is supported on the current OS/PHP setup. * * @return bool */ public static function isSupported() { return function_exists('finfo_open'); } /** * {@inheritdoc} */ public function guess($path) { if (!is_file($path)) { throw new FileNotFoundException($path); } if (!is_readable($path)) { throw new AccessDeniedException($path); } if (!self::isSupported()) { return; } if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) { return; } return $finfo->file($path); } } __halt_compiler();----SIGNATURE:----SIEWJpWbLk3Ut+MUSPFCKQuanBLTNRLfd7a5gkNdOpskSqBkNw6xl9rbMGiBBtJ+F4M3GIuhZSShQJpx9Ke+O84gG1resCMlNNdpyULPbYmElnCeotT0HdrPy5FEHidGM23PF1MZNINSIhC877XEKTTSQsHc8H+CyLFz/YTDWE2Mx5oGyJlafOhhQ5nPxgYgCK692EyIrtBjXSbCNTmFNPUc/08d+H38cjBQxSqtB9yjj7m8dtCfqS52bAFxFWTlSnWR0G5+FtuCiQ7uO2igcT1/LSKR1KoWZRlxqNEIav1Om4uGr6xZ6O8G3pJevrzbDdkJYhCTSlcbZ3mONMHDUJA60wkWYnwC0n2s7itdEnCATNdQrtSS+Wje+kIhDIsokUiByaxjNvqPgWBDRMUOzcxYNKyBn8JNkoGmJv6Tv3Mj2DTh85ZRGcxQLcm0cKzKiJW2Y7KrW/9uZRv8w4DWRhslx1d5HI2A3IaRq3AzTy1CKHAD1qMKatEqmqRLWskEvsPYPs5kXv0VghwXBDJCjzQm7/JLeSZb4Zo5CSvErZ2SV/yD4x473i3+BFqSvnl7ZONmuX6uqXt02gXcWSo77P2aWBnCMQhKcQKMWX7vyIYfpA3uUFiJxh3Egk9ppRjSr3pqugJTAE1W0zhXwtazKpECTIPkFGG94nhPAEa/BGM=----ATTACHMENT:----NjY5MTA5MTcyNjMxMDkwMyA5NDI1MDMyNjc3NzExMjc1IDM4Mjg4OTA4NTEyNzY5NDE=