PHP Class Inpsyde\MultilingualPress\Module\Redirect\LanguageNegotiation\AcceptLanguageParser

Since: 3.0.0
Inheritance: implements Inpsyde\MultilingualPress\Common\AcceptHeader\AcceptHeaderParser
Show file Open project: inpsyde/multilingual-press

Public Methods

Method Description
parse ( string $header ) : array Parses the given Accept header and returns the according data in array form.

Private Methods

Method Description
get_values ( string $header ) : string[] Returns the array with the individual values of the given Accept header.
normalize_priority ( string $priority ) : float Returns a normalized float value between 0 and 1 for the given numeric string.
remove_comment ( string $header ) : string Returns the given Accept header without comment.
split_value ( string $value ) : array Returns the array with the language and priority of the given value, and an empty array for an invalid language.

Method Details

parse() public method

Parses the given Accept header and returns the according data in array form.
Since: 3.0.0
public parse ( string $header ) : array
$header string Accept header string.
return array Parsed Accept header in array form.