original_string: public static function mimetype($fullpath, $filename = null) {
          if (empty($filename)) {
              $filename = $fullpath;
          }
  
          // The mimeinfo function determines the mimetype purely based on the file extension.
          $type = mimeinfo('type', $filename);
  
          if ($type === 'document/unknown') {
              // The type is unknown. Inspect the file now.
              $type = self::mimetype_from_file($fullpath);
          }
          return $type;
      }
code: public static function mimetype($fullpath, $filename = null) {
          if (empty($filename)) {
              $filename = $fullpath;
          }
  
          // The mimeinfo function determines the mimetype purely based on the file extension.
          $type = mimeinfo('type', $filename);
  
          if ($type === 'document/unknown') {
              // The type is unknown. Inspect the file now.
              $type = self::mimetype_from_file($fullpath);
          }
          return $type;
      }
code_tokens: public static function mimetype ( $ fullpath , $ filename = null ) { if ( empty ( $ filename ) ) { $ filename = $ fullpath ; } // The mimeinfo function determines the mimetype purely based on the file extension. $ type = mimeinfo ( 'type' , $ filename ) ; if ( $ type === 'document/unknown' ) { // The type is unknown. Inspect the file now. $ type = self :: mimetype_from_file ( $ fullpath ) ; } return $ type ; }
docstring: Return mimetype by given file pathname.
  
  If file has a known extension, we return the mimetype based on extension.
  Otherwise (when possible) we try to get the mimetype from file contents.
  
  @param string $fullpath Full path to the file on disk
  @param string $filename Correct file name with extension, if omitted will be taken from $path
  @return string
docstring_tokens: Return mimetype by given file pathname .