src/Http/ContentNegotiation/EncodingMatcher.php
private function rankAcceptCharsetHeaders(array $charsetHeaders): array
    {
        usort($charsetHeaders, [$this, 'compareAcceptCharsetHeaders']);
        $rankedCharsetHeaders = array_filter($charsetHeaders, [$this, 'filterZeroScores']);

        // Have to return the values because the keys aren't updated in array_filter()
        return array_values($rankedCharsetHeaders);
    }
private function rankAcceptCharsetHeaders(array $charsetHeaders): array
    {
        usort($charsetHeaders, [$this, 'compareAcceptCharsetHeaders']);
        $rankedCharsetHeaders = array_filter($charsetHeaders, [$this, 'filterZeroScores']);

        // Have to return the values because the keys aren't updated in array_filter()
        return array_values($rankedCharsetHeaders);
    }
Ranks the charset headers by quality, and then by specificity

@param AcceptCharsetHeaderValue[] $charsetHeaders The list of charset headers to rank
@return AcceptCharsetHeaderValue[] The ranked list of charset headers