From ec9b1488c48c1e1ce4164d9809eefa5b14eb4b6a Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 5 Jul 2019 15:27:56 +0200 Subject: [PATCH] #2868 --- src/Country.php | 2 +- src/Locale.php | 2 +- src/{List.php => LocalizedList.php} | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) rename src/{List.php => LocalizedList.php} (70%) diff --git a/src/Country.php b/src/Country.php index 4ebd3c1..bd24571 100644 --- a/src/Country.php +++ b/src/Country.php @@ -6,5 +6,5 @@ namespace Cubist\Locale; class Country extends LocalizedList { - protected static $_listPath = '/vendor/umpirsky/country-list/data/$locale/country.php'; + protected static $_listPath = 'vendor/umpirsky/country-list/data/$locale/country.php'; } diff --git a/src/Locale.php b/src/Locale.php index 2a854fa..a0fbee7 100644 --- a/src/Locale.php +++ b/src/Locale.php @@ -4,5 +4,5 @@ namespace Cubist\Locale; class Locale extends LocalizedList { - protected static $_listPath = '/vendor/umpirsky/locale-list/data/$locale/locales.php'; + protected static $_listPath = 'vendor/umpirsky/locale-list/data/$locale/locales.php'; } diff --git a/src/List.php b/src/LocalizedList.php similarity index 70% rename from src/List.php rename to src/LocalizedList.php index 4bc03d9..4c61c92 100644 --- a/src/List.php +++ b/src/LocalizedList.php @@ -4,7 +4,7 @@ namespace Cubist\Locale; class LocalizedList { protected static $_rawList = []; - protected static $_listPath=''; + protected static $_listPath = ''; public static function getList($locale) { @@ -20,6 +20,10 @@ class LocalizedList */ protected static function _getList($locale) { - include base_path(str_replace('$locale',$locale,self::$_listPath)); + $f = base_path(str_replace('$locale', $locale, self::$_listPath)); + if (!file_exists($f)) { + return []; + } + include $f; } } -- 2.39.5