]> _ Git - cubist_locale.git/commitdiff
#2868
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 5 Jul 2019 12:42:11 +0000 (14:42 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 5 Jul 2019 12:42:11 +0000 (14:42 +0200)
composer.json
src/Country.php [new file with mode: 0644]
src/CubistLocaleProvider.php [deleted file]
src/List.php [new file with mode: 0644]
src/Locale.php [new file with mode: 0644]

index 3aff7e4ebb719397219d9ceddef8b0fb2bdf805b..cf1222ec85df427df72eae5df3b52d0a4e317590 100644 (file)
@@ -22,7 +22,8 @@
     "require": {
         "php": ">=7.1.3",
         "umpirsky/locale-list": "^1.0",
-        "umpirsky/country-list": "^2.0"
+        "umpirsky/country-list": "^2.0",
+        "laravel/framework": "^5.8"
     },
     "require-dev": {
     },
@@ -32,7 +33,7 @@
         },
         "laravel": {
             "providers": [
-                "Cubist\\Locale\\CubistLocaleServiceProvider"
+
             ],
             "aliases": {
 
diff --git a/src/Country.php b/src/Country.php
new file mode 100644 (file)
index 0000000..9bd337d
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+
+namespace Cubist\Locale;
+
+
+class Locale extends LocalizedList
+{
+    protected static $_listPath = '/vendor/umpirsky/country-list/data/$locale/country.php';
+}
diff --git a/src/CubistLocaleProvider.php b/src/CubistLocaleProvider.php
deleted file mode 100644 (file)
index f7dfad8..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-namespace Cubist\Locale;
-
-use Illuminate\Support\ServiceProvider;
-
-class CubistBackpackServiceProvider extends ServiceProvider
-{
-    /**
-     * Indicates if loading of the provider is deferred.
-     *
-     * @var bool
-     */
-    protected $defer = false;
-
-    const NAMESPACE = 'cubist_locale';
-
-
-    /**
-     * Perform post-registration booting of services.
-     *
-     * @return void
-     */
-    public function boot()
-    {
-
-    }
-
-
-    /**
-     * Register any package services.
-     *
-     * @return void
-     */
-    public function register()
-    {
-
-    }
-}
diff --git a/src/List.php b/src/List.php
new file mode 100644 (file)
index 0000000..4bc03d9
--- /dev/null
@@ -0,0 +1,25 @@
+<?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));
+    }
+}
diff --git a/src/Locale.php b/src/Locale.php
new file mode 100644 (file)
index 0000000..2a854fa
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+namespace Cubist\Locale;
+
+class Locale extends LocalizedList
+{
+    protected static $_listPath = '/vendor/umpirsky/locale-list/data/$locale/locales.php';
+}