original_string: protected function get_mimetype_from_filename($filename) {
          $mimetype = 'application/unknown';
          $types = core_filetypes::get_types();
          $fileextension = '.bin';
          if (strpos($filename, '.') !== false) {
              $fileextension = substr($filename, strrpos($filename, '.') + 1);
          }
  
          if (isset($types[$fileextension])) {
              $mimetype = $types[$fileextension]['type'];
          }
          return $mimetype;
      }
code: protected function get_mimetype_from_filename($filename) {
          $mimetype = 'application/unknown';
          $types = core_filetypes::get_types();
          $fileextension = '.bin';
          if (strpos($filename, '.') !== false) {
              $fileextension = substr($filename, strrpos($filename, '.') + 1);
          }
  
          if (isset($types[$fileextension])) {
              $mimetype = $types[$fileextension]['type'];
          }
          return $mimetype;
      }
code_tokens: protected function get_mimetype_from_filename ( $ filename ) { $ mimetype = 'application/unknown' ; $ types = core_filetypes :: get_types ( ) ; $ fileextension = '.bin' ; if ( strpos ( $ filename , '.' ) !== false ) { $ fileextension = substr ( $ filename , strrpos ( $ filename , '.' ) + 1 ) ; } if ( isset ( $ types [ $ fileextension ] ) ) { $ mimetype = $ types [ $ fileextension ] [ 'type' ] ; } return $ mimetype ; }
docstring: Given a filename, use the core_filetypes registered types to guess a mimetype.
  
  If no mimetype is known, return 'application/unknown';
  
  @param string $filename
  @return string $mimetype
docstring_tokens: Given a filename use the core_filetypes registered types to guess a mimetype .