protected function getAllowedLocales()
 {
     if (null !== $this->allowedLocalesProvider) {
         return $this->allowedLocalesProvider->getAllowedLocales();
     } else {
         array();
     }
 }
 /**
  * {@inheritdoc}
  */
 public function match($locale)
 {
     $allowedLocales = $this->allowedLocaleProvider->getAllowedLocales();
     uasort($allowedLocales, function ($a, $b) {
         return strlen($b) - strlen($a);
     });
     foreach ($allowedLocales as $allowedLocale) {
         if (strpos($locale, $allowedLocale) === 0) {
             return $allowedLocale;
         }
     }
     return false;
 }