getFallbackRule() публичный Метод

Returns the current fallback rule.
См. также: setFallbackRule()
public getFallbackRule ( ) : array
Результат array
Пример #1
0
 /**
  * Build a chain of locale objects according to the fallback rule and
  * the available locales.
  * @param Locale $locale
  * @return array
  */
 public function getLocaleChain(Locale $locale)
 {
     $fallbackRule = $this->configuration->getFallbackRule();
     $localeChain = [(string) $locale => $locale];
     if ($fallbackRule['strict'] === true) {
         foreach ($fallbackRule['order'] as $localeIdentifier) {
             $localeChain[$localeIdentifier] = new Locale($localeIdentifier);
         }
     } else {
         $locale = $this->findBestMatchingLocale($locale);
         while ($locale !== null) {
             $localeChain[(string) $locale] = $locale;
             $locale = $this->getParentLocaleOf($locale);
         }
         foreach ($fallbackRule['order'] as $localeIdentifier) {
             $locale = new Locale($localeIdentifier);
             $locale = $this->findBestMatchingLocale($locale);
             while ($locale !== null) {
                 $localeChain[(string) $locale] = $locale;
                 $locale = $this->getParentLocaleOf($locale);
             }
         }
     }
     $locale = $this->configuration->getDefaultLocale();
     $localeChain[(string) $locale] = $locale;
     return $localeChain;
 }