/**
* Inspect HTTP_ACCEPT_LANGUAGE and parse priority parameters.
*
* @param string $accept_header Accept header string
* @return array
*/
private function parse_accept_header($accept_header)
{
$fields = $this->parser->parse($accept_header);
if (empty($fields)) {
return $fields;
}
$out = [];
foreach ($fields as $name => $priority) {
$name = strtolower($name);
$out[$name] = $priority;
$short = $this->get_short_form($name);
if ($short && $short !== $name && !isset($out[$short])) {
$out[$short] = $priority;
}
}
return $out;
}