Documentation

AcceptLanguageParser
in package

Parses the Accept-Language header.

Tags
author

DeviceAtlas Limited

Table of Contents

$LANG_LOCALE_LENGTH  : mixed
$LANG_LOCALE_SEPARATOR  : mixed
$LANG_LENGTH  : mixed
$LANG_LOCALE_WEIGHT_SEPARATOR  : mixed
$MAX_WEIGHT  : mixed
$PARTS_SEPARATOR  : mixed
$WEIGHT_PREFIX  : mixed
parse()  : mixed
Returns the lang locale with the highest weight from the Accept-Language header.
__construct()  : mixed
getWeight()  : mixed
isBestLanguageLocale()  : mixed
The best lang locale is one that contains both language and locale and where the weight is 1 (max).
isBetterLanguageLocale()  : mixed
Prefer the new lang locale if: the new weight is greater than the current one OR if the weights are even AND the current lang locale only contains language and the new one contains language and locale.
isValidLanguageLocale()  : mixed

Properties

Methods

parse()

Returns the lang locale with the highest weight from the Accept-Language header.

public static parse(mixed $acceptLanguage) : mixed
Parameters
$acceptLanguage : mixed
Return values
mixed

getWeight()

private static getWeight(mixed $languageLocaleWeight) : mixed
Parameters
$languageLocaleWeight : mixed
Return values
mixed

isBestLanguageLocale()

The best lang locale is one that contains both language and locale and where the weight is 1 (max).

private static isBestLanguageLocale(mixed $languageLocale, mixed $weight) : mixed
Parameters
$languageLocale : mixed
$weight : mixed
Return values
mixed

isBetterLanguageLocale()

Prefer the new lang locale if: the new weight is greater than the current one OR if the weights are even AND the current lang locale only contains language and the new one contains language and locale.

private static isBetterLanguageLocale(mixed $weight, mixed $bestWeight, mixed $languageLocale, mixed $bestLanguageLocale) : mixed
Parameters
$weight : mixed
$bestWeight : mixed
$languageLocale : mixed
$bestLanguageLocale : mixed
Return values
mixed

isValidLanguageLocale()

private static isValidLanguageLocale(mixed $languageLocale) : mixed
Parameters
$languageLocale : mixed
Return values
mixed

Search results