public function parseContentTypeHeader(HttpHeaders $headers): ?ContentTypeHeaderValue
    {
        if (!$headers->containsKey('Content-Type')) {
            return null;
        }

        $contentTypeHeaderParameters = $this->parseParameters($headers, 'Content-Type');
        $contentType = $contentTypeHeaderParameters->getKeys()[0];

        return new ContentTypeHeaderValue($contentType, $contentTypeHeaderParameters);
    }
public function parseContentTypeHeader(HttpHeaders $headers): ?ContentTypeHeaderValue
    {
        if (!$headers->containsKey('Content-Type')) {
            return null;
        }

        $contentTypeHeaderParameters = $this->parseParameters($headers, 'Content-Type');
        $contentType = $contentTypeHeaderParameters->getKeys()[0];

        return new ContentTypeHeaderValue($contentType, $contentTypeHeaderParameters);
    }
public function parseContentTypeHeader ( HttpHeaders $ headers ) : ? ContentTypeHeaderValue { if ( ! $ headers -> containsKey ( 'Content-Type' ) ) { return null ; } $ contentTypeHeaderParameters = $ this -> parseParameters ( $ headers , 'Content-Type' ) ; $ contentType = $ contentTypeHeaderParameters -> getKeys ( ) [ 0 ] ; return new ContentTypeHeaderValue ( $ contentType , $ contentTypeHeaderParameters ) ; }
Parses the Content-Type header

@param HttpHeaders $headers The request headers to parse
@return ContentTypeHeaderValue|null The parsed header if one exists, otherwise null
@throws InvalidArgumentException Thrown if the headers were incorrectly formatted
Parses the Content - Type header