AcceptLanguageParser
    
            
            in package
            
        
    
    
    
Parses the Accept-Language header.
Tags
Table of Contents
Properties
- $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
Methods
- 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
$LANG_LOCALE_LENGTH
    public
    static    mixed
    $LANG_LOCALE_LENGTH
     = 5
    
    
    
$LANG_LOCALE_SEPARATOR
    public
    static    mixed
    $LANG_LOCALE_SEPARATOR
     = '-'
    
    
    
$LANG_LENGTH
    private
    static    mixed
    $LANG_LENGTH
     = 2
    
    
    
$LANG_LOCALE_WEIGHT_SEPARATOR
    private
    static    mixed
    $LANG_LOCALE_WEIGHT_SEPARATOR
     = ';'
    
    
    
$MAX_WEIGHT
    private
    static    mixed
    $MAX_WEIGHT
     = 1.0
    
    
    
$PARTS_SEPARATOR
    private
    static    mixed
    $PARTS_SEPARATOR
     = ','
    
    
    
$WEIGHT_PREFIX
    private
    static    mixed
    $WEIGHT_PREFIX
     = "q="
    
    
    
Methods
parse()
Returns the lang locale with the highest weight from the Accept-Language header.
    public
            static        parse(mixed $acceptLanguage) : mixed
    Parameters
- $acceptLanguage : mixed
__construct()
    private
                    __construct() : mixed
    getWeight()
    private
            static        getWeight(mixed $languageLocaleWeight) : mixed
    Parameters
- $languageLocaleWeight : 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
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
isValidLanguageLocale()
    private
            static        isValidLanguageLocale(mixed $languageLocale) : mixed
    Parameters
- $languageLocale : mixed