protected function extractHeaders()
    {
        $codes = array();

        $header = array_filter(explode(',', (string) $this->get('accept_language')));
        foreach ($header as $value) {
            if (preg_match('/;\s*(q=.*$)/', $value, $match)) {
                $quality = (float) substr(trim($match[1]), 2) * 10;
                $value = trim(substr($value, 0, -strlen($match[0])));
            } else {
                $quality = 1;
            }

            if (0 < $quality) {
                $codes[$quality] = trim($value);
            }
        }

        sort($codes);

        return $codes;
    }