\DeviceAtlas\DeviceAcceptLanguageParser

Parses the Accept-Language header.

Summary

Methods
Properties
Constants
parse()
$LANG_LOCALE_SEPARATOR
$LANG_LOCALE_LENGTH
No constants found
No protected methods found
No protected properties found
N/A
__construct()
getWeight()
isValidLanguageLocale()
isBetterLanguageLocale()
isBestLanguageLocale()
$PARTS_SEPARATOR
$LANG_LOCALE_WEIGHT_SEPARATOR
$WEIGHT_PREFIX
$LANG_LENGTH
$MAX_WEIGHT
N/A

Properties

$LANG_LOCALE_SEPARATOR

$LANG_LOCALE_SEPARATOR : 

Type

$LANG_LOCALE_LENGTH

$LANG_LOCALE_LENGTH : 

Type

$PARTS_SEPARATOR

$PARTS_SEPARATOR : 

Type

$LANG_LOCALE_WEIGHT_SEPARATOR

$LANG_LOCALE_WEIGHT_SEPARATOR : 

Type

$WEIGHT_PREFIX

$WEIGHT_PREFIX : 

Type

$LANG_LENGTH

$LANG_LENGTH : 

Type

$MAX_WEIGHT

$MAX_WEIGHT : 

Type

Methods

parse()

parse(  $acceptLanguage) 

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

Parameters

$acceptLanguage
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

__construct()

__construct() 

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

getWeight()

getWeight(  $languageLocaleWeight) 

Parameters

$languageLocaleWeight
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

isValidLanguageLocale()

isValidLanguageLocale(  $languageLocale) 

Parameters

$languageLocale
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

isBetterLanguageLocale()

isBetterLanguageLocale(  $weight,   $bestWeight,   $languageLocale,   $bestLanguageLocale) 

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.

Parameters

$weight
$bestWeight
$languageLocale
$bestLanguageLocale
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

isBestLanguageLocale()

isBestLanguageLocale(  $languageLocale,   $weight) 

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

Parameters

$languageLocale
$weight
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275