src/POData/HttpProcessUtility.php
/**
     * Returns all MIME types from the $text.
     * 
     * @param string $text Text as it appears on an HTTP Accepts header.
     * 
     * @return MediaType[] Array of media (MIME) type description.
     *
     * @throws HttpHeaderFailure If found any syntax error in the given text.
     */
Returns all MIME types from the $text.

@param string $text Text as it appears on an HTTP Accepts header.

@return MediaType[] Array of media (MIME) type description.

@throws HttpHeaderFailure If found any syntax error in the given text.
Returns all MIME types from the $text . @param string $text Text as it appears on an HTTP Accepts header . @return MediaType [] Array of media ( MIME ) type description . @throws HttpHeaderFailure If found any syntax error in the given text .
public static function mimeTypesFromAcceptHeaders($text)
    {
        $mediaTypes = array();
        $textIndex = 0;
        while (!self::skipWhitespace($text, $textIndex)) {
            $type = null;
            $subType = null;
            self::readMediaTypeAndSubtype($text, $textIndex, $type, $subType);
            $parameters = array();
            while (!self::skipWhitespace($text, $textIndex)) {
                if ($text[$textIndex] == ',') {
                    $textIndex++;
                    break;
                }
                if ($text[$textIndex] != ';') {
                    throw new HttpHeaderFailure(
                        Messages::httpProcessUtilityMediaTypeRequiresSemicolonBeforeParameter(), 
                        400
                    );
                }
                $textIndex++;
                if (self::skipWhitespace($text, $textIndex)) {
                    break;
                }
                self::readMediaTypeParameter($text, $textIndex, $parameters);
            }
            $mediaTypes[] = new MediaType($type, $subType, $parameters);
        }
        return $mediaTypes;
    }
public static function mimeTypesFromAcceptHeaders ( $ text ) { $ mediaTypes = array ( ) ; $ textIndex = 0 ; while ( ! self :: skipWhitespace ( $ text , $ textIndex ) ) { $ type = null ; $ subType = null ; self :: readMediaTypeAndSubtype ( $ text , $ textIndex , $ type , $ subType ) ; $ parameters = array ( ) ; while ( ! self :: skipWhitespace ( $ text , $ textIndex ) ) { if ( $ text [ $ textIndex ] == ',' ) { $ textIndex ++ ; break ; } if ( $ text [ $ textIndex ] != ';' ) { throw new HttpHeaderFailure ( Messages :: httpProcessUtilityMediaTypeRequiresSemicolonBeforeParameter ( ) , 400 ) ; } $ textIndex ++ ; if ( self :: skipWhitespace ( $ text , $ textIndex ) ) { break ; } self :: readMediaTypeParameter ( $ text , $ textIndex , $ parameters ) ; } $ mediaTypes [ ] = new MediaType ( $ type , $ subType , $ parameters ) ; } return $ mediaTypes ; }
Returns all MIME types from the $text.
Returns all MIME types from the $text .