src/KPhoen/Provider/FakerServiceProvider.php
protected function getBestLanguage(Request $request, $default = null)
    {
        foreach ($request->getLanguages() as $language) {
            if (strpos($language, '_') !== false) {
                return $language;
            }
        }

        return $default;
    }
protected function getBestLanguage(Request $request, $default = null)
    {
        foreach ($request->getLanguages() as $language) {
            if (strpos($language, '_') !== false) {
                return $language;
            }
        }

        return $default;
    }
protected function getBestLanguage ( Request $ request , $ default = null ) { foreach ( $ request -> getLanguages ( ) as $ language ) { if ( strpos ( $ language , '_' ) !== false ) { return $ language ; } } return $ default ; }
Finds the best language for a given request.

@param Request $request  The request.
@param string  $default  The default language if nothing satisfying is
found in the request.
Finds the best language for a given request .