protected function parseMediaTypeVersion($mediaType)
    {
        $version = '1.0';
        $contentType = explode('; ', $mediaType);
        if (count($contentType) > 1) {
            $mediaType = $contentType[0];
            foreach (array_slice($contentType, 1) as $parameterString) {
                if (strpos($contentType[1], '=') === false) {
                    throw new Exceptions\Parser("Unknown parameter format: '{$parameterString}'");
                }
                list($parameterName, $parameterValue) = explode('=', $parameterString);
                if (trim($parameterName) === 'version') {
                    $version = trim($parameterValue);
                    break;
                }
            }
        }

        return [$mediaType, $version];
    }
protected function parseMediaTypeVersion($mediaType)
    {
        $version = '1.0';
        $contentType = explode('; ', $mediaType);
        if (count($contentType) > 1) {
            $mediaType = $contentType[0];
            foreach (array_slice($contentType, 1) as $parameterString) {
                if (strpos($contentType[1], '=') === false) {
                    throw new Exceptions\Parser("Unknown parameter format: '{$parameterString}'");
                }
                list($parameterName, $parameterValue) = explode('=', $parameterString);
                if (trim($parameterName) === 'version') {
                    $version = trim($parameterValue);
                    break;
                }
            }
        }

        return [$mediaType, $version];
    }
protected function parseMediaTypeVersion ( $ mediaType ) { $ version = '1.0' ; $ contentType = explode ( '; ' , $ mediaType ) ; if ( count ( $ contentType ) > 1 ) { $ mediaType = $ contentType [ 0 ] ; foreach ( array_slice ( $ contentType , 1 ) as $ parameterString ) { if ( strpos ( $ contentType [ 1 ] , '=' ) === false ) { throw new Exceptions \ Parser ( "Unknown parameter format: '{$parameterString}'" ) ; } list ( $ parameterName , $ parameterValue ) = explode ( '=' , $ parameterString ) ; if ( trim ( $ parameterName ) === 'version' ) { $ version = trim ( $ parameterValue ) ; break ; } } } return [ $ mediaType , $ version ] ; }
Parses and returns the version from a MediaType.

@param string $mediaType Ex: text/html; version=1.1

@return string An array with the mediatype string, stripped from the version, and the version (1.0 by default)
Parses and returns the version from a MediaType .