src/Http/Formatting/RequestHeaderParser.php
public function parseAcceptLanguageHeader(HttpHeaders $headers): array
    {
        $headerValues = [];

        if (!$headers->tryGet('Accept-Language', $headerValues)) {
            return [];
        }

        $parsedHeaderValues = [];
        $numHeaderValues = count($headerValues);

        for ($i = 0;$i < $numHeaderValues;$i++) {
            $parsedHeaderParameters = $this->parseParameters($headers, 'Accept-Language', $i);
            // The first value should always be the language
            $language = $parsedHeaderParameters->getKeys()[0];
            $parsedHeaderValues[] = new AcceptLanguageHeaderValue($language, $parsedHeaderParameters);
        }

        return $parsedHeaderValues;
    }
public function parseAcceptLanguageHeader(HttpHeaders $headers): array
    {
        $headerValues = [];

        if (!$headers->tryGet('Accept-Language', $headerValues)) {
            return [];
        }

        $parsedHeaderValues = [];
        $numHeaderValues = count($headerValues);

        for ($i = 0;$i < $numHeaderValues;$i++) {
            $parsedHeaderParameters = $this->parseParameters($headers, 'Accept-Language', $i);
            // The first value should always be the language
            $language = $parsedHeaderParameters->getKeys()[0];
            $parsedHeaderValues[] = new AcceptLanguageHeaderValue($language, $parsedHeaderParameters);
        }

        return $parsedHeaderValues;
    }
public function parseAcceptLanguageHeader ( HttpHeaders $ headers ) : array { $ headerValues = [ ] ; if ( ! $ headers -> tryGet ( 'Accept-Language' , $ headerValues ) ) { return [ ] ; } $ parsedHeaderValues = [ ] ; $ numHeaderValues = count ( $ headerValues ) ; for ( $ i = 0 ; $ i < $ numHeaderValues ; $ i ++ ) { $ parsedHeaderParameters = $ this -> parseParameters ( $ headers , 'Accept-Language' , $ i ) ; // The first value should always be the language $ language = $ parsedHeaderParameters -> getKeys ( ) [ 0 ] ; $ parsedHeaderValues [ ] = new AcceptLanguageHeaderValue ( $ language , $ parsedHeaderParameters ) ; } return $ parsedHeaderValues ; }
Parses the Accept-Language header

@param HttpHeaders $headers The request headers to parse
@return AcceptLanguageHeaderValue[] The list of language header values
@throws InvalidArgumentException Thrown if the headers were incorrectly formatted
Parses the Accept - Language header