Example #1
0
 /**
  * Get locale from accepted languages header.
  *
  * @return null|string
  */
 private function getFromAcceptedLanguagesHeader()
 {
     $matches = $this->getMatchesFromAcceptedLanguages();
     if ($locale = $this->inSupportedLocales($matches)) {
         return $locale;
     }
     // If any (i.e. "*") is acceptable, return the first supported locale
     if (isset($matches['*'])) {
         return $this->supportedLocales->first()->key();
     }
     return null;
 }