]> _ Git - cubist_locale.git/commitdiff
#2868
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 5 Jul 2019 13:44:20 +0000 (15:44 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 5 Jul 2019 13:44:20 +0000 (15:44 +0200)
src/Country.php
src/Locale.php
src/LocalizedList.php

index bd245713b8dc4e768960db9610b5bc8b40d51584..d2ca904bd0607d479ec25bece26b6b714f25a1ba 100644 (file)
@@ -6,5 +6,7 @@ namespace Cubist\Locale;
 
 class Country extends LocalizedList
 {
-    protected static $_listPath = 'vendor/umpirsky/country-list/data/$locale/country.php';
+    protected static function _getListPath(){
+        return 'vendor/umpirsky/country-list/data/$locale/country.php';
+    }
 }
index a0fbee734859040c8177ca4065c36257f946dd6e..700400e8cdefa0cd3db9b092c42ff78be737fb41 100644 (file)
@@ -4,5 +4,9 @@ namespace Cubist\Locale;
 
 class Locale extends LocalizedList
 {
-    protected static $_listPath = 'vendor/umpirsky/locale-list/data/$locale/locales.php';
+
+    protected static function _getListPath()
+    {
+        return 'vendor/umpirsky/locale-list/data/$locale/locales.php';
+    }
 }
index 2dab6d00db64938326348208e1885d37f522bc61..8c6e46475b29256b958be807a3262a50208d0420 100644 (file)
@@ -8,10 +8,15 @@ class LocalizedList
 
     public static function getList($locale)
     {
-        if (!isset(self::$_rawList[$locale])) {
-            self::$_rawList[$locale] = static::_getList($locale);
+        if (!isset(static::$_rawList[$locale])) {
+            static::$_rawList[$locale] = static::_getList($locale);
         }
-        return self::$_rawList[$locale];
+        return static::$_rawList[$locale];
+    }
+
+    protected static function _getListPath()
+    {
+        return '';
     }
 
     /**
@@ -20,7 +25,7 @@ class LocalizedList
      */
     protected static function _getList($locale)
     {
-        $f = base_path(str_replace('$locale', $locale, self::$_listPath));
+        $f = base_path(str_replace('$locale', $locale, static::_getListPath()));
         if (!file_exists($f) || !is_file($f)) {
             return [];
         }