original_string: public static function analyzeData($data, $magic_db = null,
                                         $opts = array())
      {
          /* If the PHP Mimetype extension is available, use that. */
          if (Horde_Util::extensionExists('fileinfo')) {
              $res = empty($magic_db)
                  ? @finfo_open(FILEINFO_MIME)
                  : @finfo_open(FILEINFO_MIME, $magic_db);
  
              if (!$res) {
                  return false;
              }
  
              $type = trim(finfo_buffer($res, $data));
              finfo_close($res);
  
              /* Remove any additional information. */
              if (empty($opts['nostrip'])) {
                  if (($pos = strpos($type, ';')) !== false) {
                      $type = rtrim(substr($type, 0, $pos));
                  }
  
                  if (($pos = strpos($type, ',')) !== false) {
                      $type = rtrim(substr($type, 0, $pos));
                  }
              }
  
              return $type;
          }
  
          return false;
      }
code: public static function analyzeData($data, $magic_db = null,
                                         $opts = array())
      {
          /* If the PHP Mimetype extension is available, use that. */
          if (Horde_Util::extensionExists('fileinfo')) {
              $res = empty($magic_db)
                  ? @finfo_open(FILEINFO_MIME)
                  : @finfo_open(FILEINFO_MIME, $magic_db);
  
              if (!$res) {
                  return false;
              }
  
              $type = trim(finfo_buffer($res, $data));
              finfo_close($res);
  
              /* Remove any additional information. */
              if (empty($opts['nostrip'])) {
                  if (($pos = strpos($type, ';')) !== false) {
                      $type = rtrim(substr($type, 0, $pos));
                  }
  
                  if (($pos = strpos($type, ',')) !== false) {
                      $type = rtrim(substr($type, 0, $pos));
                  }
              }
  
              return $type;
          }
  
          return false;
      }
code_tokens: public static function analyzeData ( $ data , $ magic_db = null , $ opts = array ( ) ) { /* If the PHP Mimetype extension is available, use that. */ if ( Horde_Util :: extensionExists ( 'fileinfo' ) ) { $ res = empty ( $ magic_db ) ? @ finfo_open ( FILEINFO_MIME ) : @ finfo_open ( FILEINFO_MIME , $ magic_db ) ; if ( ! $ res ) { return false ; } $ type = trim ( finfo_buffer ( $ res , $ data ) ) ; finfo_close ( $ res ) ; /* Remove any additional information. */ if ( empty ( $ opts [ 'nostrip' ] ) ) { if ( ( $ pos = strpos ( $ type , ';' ) ) !== false ) { $ type = rtrim ( substr ( $ type , 0 , $ pos ) ) ; } if ( ( $ pos = strpos ( $ type , ',' ) ) !== false ) { $ type = rtrim ( substr ( $ type , 0 , $ pos ) ) ; } } return $ type ; } return false ; }
docstring: Attempt to determine the MIME type of an unknown byte stream.
  
  @param string $data      The file data to analyze.
  @param string $magic_db  Path to the mime magic database.
  @param array $opts       Additional options:
  - nostrip: (boolean) Don't strip parameter information from MIME
  type string.
  DEFAULT: false
  
  @return mixed  The MIME type of the file. Returns false if the file
  type can not be determined.
docstring_tokens: Attempt to determine the MIME type of an unknown byte stream .