MediaWiki REL1_34
Wikimedia\Http\HttpAcceptParser Class Reference

Public Member Functions

 parseWeights ( $rawHeader)
 Parses an HTTP header into a weight map, that is an associative array mapping values to their respective weights.
 

Detailed Description

Definition at line 13 of file HttpAcceptParser.php.

Member Function Documentation

◆ parseWeights()

Wikimedia\Http\HttpAcceptParser::parseWeights (   $rawHeader)

Parses an HTTP header into a weight map, that is an associative array mapping values to their respective weights.

Any header name preceding weight spec is ignored for convenience.

This implementation is partially based on the code at http://www.thefutureoftheweb.com/blog/use-accept-language-header

Note that type parameters and accept extension like the "level" parameter are not supported, weights are derived from "q" values only.

Todo:
If additional type parameters are present, ignore them cleanly. At present, they often confuse the result.

See HTTP/1.1 section 14 for details.

Parameters
string$rawHeader
Returns
array

Definition at line 35 of file HttpAcceptParser.php.


The documentation for this class was generated from the following file: