private function extractDataOfLanguage($lang)
    {
        $found = [];
        // parsing language preference instructions
        // 2_digit_code[-longer_code][;q=coefficient]
        preg_match('/([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?/', $lang, $found);
        // 2 digit lang code
        $code = isset($found[1]) ? $found[1] : null;
        // lang code complement
        $morecode = isset($found[3]) ? $found[3] : null;
        // full lang code
        $fullcode = $morecode ? $code.'-'.$morecode : $code;
        // coefficient
        $coef = sprintf('%3.1f', isset($found[5]) ? $found[5] : '1');
        // for sorting by coefficient
        // adding
        return array('code' => $code,'coef' => $coef,'morecode' => $morecode,'fullcode' => $fullcode);
    }
private function extractDataOfLanguage($lang)
    {
        $found = [];
        // parsing language preference instructions
        // 2_digit_code[-longer_code][;q=coefficient]
        preg_match('/([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?/', $lang, $found);
        // 2 digit lang code
        $code = isset($found[1]) ? $found[1] : null;
        // lang code complement
        $morecode = isset($found[3]) ? $found[3] : null;
        // full lang code
        $fullcode = $morecode ? $code.'-'.$morecode : $code;
        // coefficient
        $coef = sprintf('%3.1f', isset($found[5]) ? $found[5] : '1');
        // for sorting by coefficient
        // adding
        return array('code' => $code,'coef' => $coef,'morecode' => $morecode,'fullcode' => $fullcode);
    }
private function extractDataOfLanguage ( $ lang ) { $ found = [ ] ; // parsing language preference instructions // 2_digit_code[-longer_code][;q=coefficient] preg_match ( '/([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?/' , $ lang , $ found ) ; // 2 digit lang code $ code = isset ( $ found [ 1 ] ) ? $ found [ 1 ] : null ; // lang code complement $ morecode = isset ( $ found [ 3 ] ) ? $ found [ 3 ] : null ; // full lang code $ fullcode = $ morecode ? $ code . '-' . $ morecode : $ code ; // coefficient $ coef = sprintf ( '%3.1f' , isset ( $ found [ 5 ] ) ? $ found [ 5 ] : '1' ) ; // for sorting by coefficient // adding return array ( 'code' => $ code , 'coef' => $ coef , 'morecode' => $ morecode , 'fullcode' => $ fullcode ) ; }
Get the language browser data
@param  string        $lang
@return array<string, string>
Get the language browser data