public function parseAcceptCharsetHeader(HttpHeaders $headers): array
    {
        $headerValues = [];

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

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

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

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

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

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

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

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

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