]> _ Git - cubist_locale.git/commitdiff
#2868
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 8 Jul 2019 10:17:19 +0000 (12:17 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 8 Jul 2019 10:17:19 +0000 (12:17 +0200)
src/Country.php
src/Locale.php
src/LocalizedList.php

index d2ca904bd0607d479ec25bece26b6b714f25a1ba..cd7ec943041ec0116f4fec120661465fcff1e5b4 100644 (file)
@@ -1,12 +1,11 @@
 <?php
 
-
 namespace Cubist\Locale;
 
-
 class Country extends LocalizedList
 {
-    protected static function _getListPath(){
+    protected static function _getListPath()
+    {
         return 'vendor/umpirsky/country-list/data/$locale/country.php';
     }
 }
index 700400e8cdefa0cd3db9b092c42ff78be737fb41..81ab8919b5a339d3582d49bfd179c0a241a2c33a 100644 (file)
@@ -4,7 +4,6 @@ namespace Cubist\Locale;
 
 class Locale extends LocalizedList
 {
-
     protected static function _getListPath()
     {
         return 'vendor/umpirsky/locale-list/data/$locale/locales.php';
index 8c6e46475b29256b958be807a3262a50208d0420..c6467256789ff4434daff98be7893535e73071b4 100644 (file)
@@ -8,10 +8,13 @@ class LocalizedList
 
     public static function getList($locale)
     {
-        if (!isset(static::$_rawList[$locale])) {
-            static::$_rawList[$locale] = static::_getList($locale);
+        if (!isset(self::$_rawList[static::class])) {
+            self::$_rawList[static::class] = [];
         }
-        return static::$_rawList[$locale];
+        if (!isset(static::$_rawList[static::class][$locale])) {
+            static::$_rawList[static::class][$locale] = static::_getList($locale);
+        }
+        return static::$_rawList[static::class][$locale];
     }
 
     protected static function _getListPath()
@@ -26,9 +29,12 @@ class LocalizedList
     protected static function _getList($locale)
     {
         $f = base_path(str_replace('$locale', $locale, static::_getListPath()));
+
         if (!file_exists($f) || !is_file($f)) {
             return [];
         }
-        include $f;
+
+        $res = include $f;
+        return $res;
     }
 }