Networking\InitCmsBundle\EventListener\LocaleListener::splitHttpAcceptHeader PHP Метод

splitHttpAcceptHeader() публичный Метод

split http accept header
public splitHttpAcceptHeader ( string $header ) : array
$header string
Результат array
    public function splitHttpAcceptHeader($header)
    {
        $values = array();
        foreach (array_filter(explode(',', $header)) as $value) {
            // Cut off any q-value that might come after a semi-colon
            if ($pos = strpos($value, ';')) {
                $q = (double) trim(substr($value, strpos($value, '=') + 1));
                $value = substr($value, 0, $pos);
            } else {
                $q = 1;
            }
            if (0 < $q) {
                $values[trim($value)] = $q;
            }
        }
        arsort($values);
        return array_keys($values);
    }