src/Negotiator/Matcher/PartialLanguageMatcher.php
private function partialLangMatches(
        $fromField,
        MatchedPreferenceInterface $matchedPreference,
        PreferenceInterface $newClientPref
    ) {
        $serverPref = $matchedPreference->getServerPreference();
        $oldClientPref = $matchedPreference->getClientPreference();

        // Note that this only supports the simplest case of (e.g.) en-* matching en-GB and en-US, additional
        // Language tags are explicitly ignored
        list($clientMainLang) = explode('-', $newClientPref->getVariant());
        list($serverMainLang) = explode('-', $serverPref->getVariant());

        return PreferenceInterface::LANGUAGE === $fromField
            && PreferenceInterface::PARTIAL_WILDCARD === $serverPref->getPrecedence()
            && $clientMainLang == $serverMainLang
            && $newClientPref->getPrecedence() > $oldClientPref->getPrecedence();
    }
private function partialLangMatches(
        $fromField,
        MatchedPreferenceInterface $matchedPreference,
        PreferenceInterface $newClientPref
    ) {
        $serverPref = $matchedPreference->getServerPreference();
        $oldClientPref = $matchedPreference->getClientPreference();

        // Note that this only supports the simplest case of (e.g.) en-* matching en-GB and en-US, additional
        // Language tags are explicitly ignored
        list($clientMainLang) = explode('-', $newClientPref->getVariant());
        list($serverMainLang) = explode('-', $serverPref->getVariant());

        return PreferenceInterface::LANGUAGE === $fromField
            && PreferenceInterface::PARTIAL_WILDCARD === $serverPref->getPrecedence()
            && $clientMainLang == $serverMainLang
            && $newClientPref->getPrecedence() > $oldClientPref->getPrecedence();
    }
private function partialLangMatches ( $ fromField , MatchedPreferenceInterface $ matchedPreference , PreferenceInterface $ newClientPref ) { $ serverPref = $ matchedPreference -> getServerPreference ( ) ; $ oldClientPref = $ matchedPreference -> getClientPreference ( ) ; // Note that this only supports the simplest case of (e.g.) en-* matching en-GB and en-US, additional // Language tags are explicitly ignored list ( $ clientMainLang ) = explode ( '-' , $ newClientPref -> getVariant ( ) ) ; list ( $ serverMainLang ) = explode ( '-' , $ serverPref -> getVariant ( ) ) ; return PreferenceInterface :: LANGUAGE === $ fromField && PreferenceInterface :: PARTIAL_WILDCARD === $ serverPref -> getPrecedence ( ) && $ clientMainLang == $ serverMainLang && $ newClientPref -> getPrecedence ( ) > $ oldClientPref -> getPrecedence ( ) ; }
Returns true if the server preference contains a partial language that matches the language in the client
preference.

e.g. An server variant of en-* would match en, en-US but not es-ES

@param string $fromField
@param MatchedPreferenceInterface $matchedPreference
@param PreferenceInterface $newClientPref

@return bool
Returns true if the server preference contains a partial language that matches the language in the client preference .