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';
}
+++ /dev/null
-<?php
-
-namespace Cubist\Locale;
-class LocalizedList
-{
- protected static $_rawList = [];
- protected static $_listPath='';
-
- public static function getList($locale)
- {
- if (!isset(self::$_rawList[$locale])) {
- self::$_rawList[$locale] = static::_getList($locale);
- }
- return self::$_rawList[$locale];
- }
-
- /**
- * @param string $locale
- * @return array
- */
- protected static function _getList($locale)
- {
- include base_path(str_replace('$locale',$locale,self::$_listPath));
- }
-}
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';
}
--- /dev/null
+<?php
+
+namespace Cubist\Locale;
+class LocalizedList
+{
+ protected static $_rawList = [];
+ protected static $_listPath = '';
+
+ public static function getList($locale)
+ {
+ if (!isset(self::$_rawList[$locale])) {
+ self::$_rawList[$locale] = static::_getList($locale);
+ }
+ return self::$_rawList[$locale];
+ }
+
+ /**
+ * @param string $locale
+ * @return array
+ */
+ protected static function _getList($locale)
+ {
+ $f = base_path(str_replace('$locale', $locale, self::$_listPath));
+ if (!file_exists($f)) {
+ return [];
+ }
+ include $f;
+ }
+}