Example #1
0
 /**
  * If the content type returned by the parent is empty the method tries to obtain it from
  * the file, if it fails {@link DEFAULT_MIME} is used as fallback.
  *
  * @inheritdoc
  */
 protected function get_content_type()
 {
     $content_type = parent::get_content_type();
     if ($content_type->value) {
         return $content_type;
     }
     $mime = null;
     if (function_exists('finfo_file')) {
         $mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->file);
     }
     return new Headers\ContentType($mime ?: self::DEFAULT_MIME);
 }