/**
  * Registers all natively provided mime type guessers
  */
 private function __construct()
 {
     if (FileBinaryMimeTypeGuesser::isSupported()) {
         $this->register(new FileBinaryMimeTypeGuesser());
     }
     if (FileinfoMimeTypeGuesser::isSupported()) {
         $this->register(new FileinfoMimeTypeGuesser());
     }
 }
 /**
  * Tries to guess the mime type of the given file.
  *
  * The file is passed to each registered mime type guesser in reverse order
  * of their registration (last registered is queried first). Once a guesser
  * returns a value that is not NULL, this method terminates and returns the
  * value.
  *
  * @param string $path The path to the file
  *
  * @return string The mime type or NULL, if none could be guessed
  *
  * @throws \LogicException
  * @throws FileNotFoundException
  * @throws AccessDeniedException
  */
 public function guess($path)
 {
     if (!is_file($path)) {
         throw new FileNotFoundException($path);
     }
     if (!is_readable($path)) {
         throw new AccessDeniedException($path);
     }
     if (!$this->guessers) {
         $msg = 'Unable to guess the mime type as no guessers are available';
         if (!FileinfoMimeTypeGuesser::isSupported()) {
             $msg .= ' (Did you enable the php_fileinfo extension?)';
         }
         throw new \LogicException($msg);
     }
     foreach ($this->guessers as $guesser) {
         if (null !== ($mimeType = $guesser->guess($path))) {
             return $mimeType;
         }
     }
 }