Passed
Push — master ( 7de9ea...5e4ab8 )
by Vasyl
03:26
created
src/Commands/GetVariable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,6 +23,6 @@
 block discarded – undo
23 23
 
24 24
         $variable = $variableMng->locale($this->argument('locale'))->get($this->argument('name'));
25 25
 
26
-        print_r($variable . "\n");
26
+        print_r($variable."\n");
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! function_exists('variable')) {
3
+if (!function_exists('variable')) {
4 4
     /**
5 5
      * @param $name
6 6
      * @param null $default
Please login to merge, or discard this patch.
config/variables.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@
 block discarded – undo
25 25
      | -----------------------------------------------------------------
26 26
      */
27 27
     'variable_config' => [
28
-        'app_name' => 'app.name',                   // config('app.name')
29
-        'app_description' => 'app.description',     // config('app.description')
30
-        'some_var' => 'services.some.var',          // config('services.some.var')
28
+        'app_name' => 'app.name', // config('app.name')
29
+        'app_description' => 'app.description', // config('app.description')
30
+        'some_var' => 'services.some.var', // config('services.some.var')
31 31
     ],
32 32
 
33 33
     /* -----------------------------------------------------------------
Please login to merge, or discard this patch.
src/VariableServiceProvider.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,20 +19,20 @@
 block discarded – undo
19 19
         ], 'variables-config');
20 20
 
21 21
         if (! class_exists('CreateVariablesTable')) {
22
-             $timestamp = date('Y_m_d_His', time());
22
+                $timestamp = date('Y_m_d_His', time());
23 23
 
24
-             $this->publishes([
25
-                 __DIR__.'/../database/migrations/create_variables_table.php.stub' => $this->app->databasePath()."/migrations/{$timestamp}_create_variables_table.php",
26
-             ], 'variables-migrations');
24
+                $this->publishes([
25
+                    __DIR__.'/../database/migrations/create_variables_table.php.stub' => $this->app->databasePath()."/migrations/{$timestamp}_create_variables_table.php",
26
+                ], 'variables-migrations');
27 27
         }
28 28
 
29 29
         $this->replaceConfigsWithVariables();
30 30
 
31 31
         if ($this->app->runningInConsole()) {
32
-             $this->commands([
33
-                 Commands\AllVariable::class,
34
-                 Commands\GetVariable::class,
35
-             ]);
32
+                $this->commands([
33
+                    Commands\AllVariable::class,
34
+                    Commands\GetVariable::class,
35
+                ]);
36 36
         }
37 37
     }
38 38
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
             __DIR__.'/../config/variables.php' => config_path('variables.php'),
19 19
         ], 'variables-config');
20 20
 
21
-        if (! class_exists('CreateVariablesTable')) {
21
+        if (!class_exists('CreateVariablesTable')) {
22 22
              $timestamp = date('Y_m_d_His', time());
23 23
 
24 24
              $this->publishes([
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $this->mergeConfigFrom(__DIR__.'/../config/variables.php', 'variables');
47 47
 
48
-        $this->app->singleton(VariableManagerContract::class, function () {
48
+        $this->app->singleton(VariableManagerContract::class, function() {
49 49
             $cacheRepo = $this->app->make(\Illuminate\Cache\Repository::class);
50 50
             return new VariableManager(new Variable, $cacheRepo, $this->app);
51 51
         });
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     protected function replaceConfigsWithVariables()
55 55
     {
56
-        $this->app->booted(function () {
56
+        $this->app->booted(function() {
57 57
 
58 58
             // package config
59 59
             $config = $this->app['config']->get('variables');
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
                 $variables = $this->app->make(VariableManagerContract::class)->all();
67 67
 
68 68
                 foreach ($variables as $varKey => $varValue) {
69
-                    $configKey = $variableConfig[$varKey] ?? ($config['config_key_for_vars'] . '.' . $varKey) ?? '';
70
-                    if (! empty($variableConfig[$varKey])) {
69
+                    $configKey = $variableConfig[$varKey] ?? ($config['config_key_for_vars'].'.'.$varKey) ?? '';
70
+                    if (!empty($variableConfig[$varKey])) {
71 71
                         $this->app['config']->set($variableConfig[$varKey], $varValue);
72 72
                     }
73
-                    if (! empty($config['config_key_for_vars'])) {
74
-                        $this->app['config']->set($config['config_key_for_vars'] . '.' . $varKey, $varValue);
73
+                    if (!empty($config['config_key_for_vars'])) {
74
+                        $this->app['config']->set($config['config_key_for_vars'].'.'.$varKey, $varValue);
75 75
                     }
76 76
                 }
77 77
             } catch (\Exception $exception) {
78
-                $this->app['log']->info(__CLASS__ . ' - ' . $exception->getMessage());
78
+                $this->app['log']->info(__CLASS__.' - '.$exception->getMessage());
79 79
             }
80 80
 
81 81
         });
Please login to merge, or discard this patch.
src/VariableManager.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@
 block discarded – undo
45 45
      */
46 46
     public function get(string $key, $default = null)
47 47
     {
48
-       if (isset($this->all()[$key])) {
49
-           return $this->all()[$key];
50
-       }
48
+        if (isset($this->all()[$key])) {
49
+            return $this->all()[$key];
50
+        }
51 51
        
52
-       return $default;
52
+        return $default;
53 53
         
54 54
     }
55 55
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function __construct($variableModel, $cacheRepository, $app = null)
28 28
     {
29
-        if (! $app) {
30
-            $app = app();   //Fallback when $app is not given
29
+        if (!$app) {
30
+            $app = app(); //Fallback when $app is not given
31 31
         }
32 32
         $this->app = $app;
33 33
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     {
61 61
         if ($this->variables === null) {
62 62
 
63
-            $all = $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function () {
63
+            $all = $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function() {
64 64
                 return $this->getCollection();
65 65
             });
66 66
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         try {
96 96
             return $this->variableModel->select('key', 'value', 'locale')->get();
97 97
         } catch (\Exception $exception) {
98
-            $this->app['log']->info(__CLASS__ . ' - ' . $exception->getMessage());
98
+            $this->app['log']->info(__CLASS__.' - '.$exception->getMessage());
99 99
 
100 100
             return null;
101 101
         }
Please login to merge, or discard this patch.