private function getLanguage(array $languageCodes, $mainLanguageCode, $alwaysAvailable)
    {
        $languageCodesSet = array_flip($languageCodes);

        foreach ($this->settings->prioritizedLanguages as $languageCode) {
            if (isset($languageCodesSet[$languageCode])) {
                return $languageCode;
            }
        }

        if ($this->settings->useAlwaysAvailable && $alwaysAvailable) {
            return $mainLanguageCode;
        }

        return null;
    }
private function getLanguage(array $languageCodes, $mainLanguageCode, $alwaysAvailable)
    {
        $languageCodesSet = array_flip($languageCodes);

        foreach ($this->settings->prioritizedLanguages as $languageCode) {
            if (isset($languageCodesSet[$languageCode])) {
                return $languageCode;
            }
        }

        if ($this->settings->useAlwaysAvailable && $alwaysAvailable) {
            return $mainLanguageCode;
        }

        return null;
    }
private function getLanguage ( array $ languageCodes , $ mainLanguageCode , $ alwaysAvailable ) { $ languageCodesSet = array_flip ( $ languageCodes ) ; foreach ( $ this -> settings -> prioritizedLanguages as $ languageCode ) { if ( isset ( $ languageCodesSet [ $ languageCode ] ) ) { return $ languageCode ; } } if ( $ this -> settings -> useAlwaysAvailable && $ alwaysAvailable ) { return $ mainLanguageCode ; } return null ; }
Returns the most prioritized language for the given parameters.

Will return null if language could not be resolved.

@param string[] $languageCodes
@param string $mainLanguageCode
@param bool $alwaysAvailable

@return string|null
Returns the most prioritized language for the given parameters .