Completed
Push — master ( 427d1b...7d660e )
by Avtandil
03:12
created
src/MultiLang/Console/MigrationCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
                 $this->info('Migration successfully created!');
54 54
             } else {
55 55
                 $this->error(
56
-                    'Couldn\'t create migration.'.PHP_EOL.' Check the write permissions
56
+                    'Couldn\'t create migration.' . PHP_EOL . ' Check the write permissions
57 57
                     within the database/migrations directory.'
58 58
                 );
59 59
             }
Please login to merge, or discard this patch.
src/MultiLang/TextsTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@
 block discarded – undo
24 24
             $options['scope'] = $request->scope;
25 25
         }
26 26
 
27
-        $texts = Text::where(function ($q) use ($options) {
27
+        $texts = Text::where(function($q) use ($options) {
28 28
             foreach ($options as $k => $v) {
29 29
                 if ($k == 'keyword') {
30
-                    $q->where(function ($query) use ($v) {
30
+                    $q->where(function($query) use ($v) {
31 31
                         $query->where('key', 'LIKE', '%' . $v . '%')->orWhere('value', 'LIKE', '%' . $v . '%');
32 32
                     });
33 33
                 } else {
Please login to merge, or discard this patch.
src/MultiLang/MultiLangServiceProvider.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
         );
49 49
 
50 50
         // Register blade directives
51
-        Blade::directive('t', function ($expression) {
51
+        Blade::directive('t', function($expression) {
52 52
             return "<?php echo e(t({$expression})); ?>";
53 53
         });
54 54
 
55
-        $this->app['events']->listen('locale.changed', function ($locale) {
55
+        $this->app['events']->listen('locale.changed', function($locale) {
56 56
             $this->app['multilang']->setLocale($locale);
57 57
         });
58 58
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
         $locales = $this->app['config']->get('multilang.locales');
72 72
         $route = $this->app['config']->get('multilang.text-route.route', 'texts');
73 73
         $controller = $this->app['config']->get('multilang.text-route.controller', '\Longman\LaravelMultiLang\Controllers\TextsController');
74
-        foreach($locales as $locale => $value) {
75
-            Route::group(['prefix' => $locale], function ($router) use ($route, $controller) {
74
+        foreach ($locales as $locale => $value) {
75
+            Route::group(['prefix' => $locale], function($router) use ($route, $controller) {
76 76
                 $router->get(
77 77
                     $route,
78 78
                     $controller . '@index'
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $configPath = __DIR__ . '/../config/config.php';
97 97
         $this->mergeConfigFrom($configPath, 'debugbar');
98 98
 
99
-        $this->app->singleton('multilang', function ($app) {
99
+        $this->app->singleton('multilang', function($app) {
100 100
             $environment = $app->environment();
101 101
             $config = $app['config']->get('multilang');
102 102
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             );
109 109
 
110 110
             if ($multilang->autoSaveIsAllowed()) {
111
-                $app->terminating(function () use ($multilang) {
111
+                $app->terminating(function() use ($multilang) {
112 112
                     return $multilang->saveTexts();
113 113
                 });
114 114
             }
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
         $this->app->alias('multilang', 'Longman\LaravelMultiLang\MultiLang');
120 120
 
121 121
         $this->app['command.multilang.migration'] = $this->app->share(
122
-            function () {
122
+            function() {
123 123
                 return new MigrationCommand();
124 124
             }
125 125
         );
126 126
 
127 127
         $this->app['command.multilang.texts'] = $this->app->share(
128
-            function () {
128
+            function() {
129 129
                 return new TextsCommand();
130 130
             }
131 131
         );
Please login to merge, or discard this patch.
src/MultiLang/Config.php 2 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,16 +28,15 @@
 block discarded – undo
28 28
     /**
29 29
      * Create a new MultiLang instance.
30 30
      *
31
-     * @param string                               $environment
32
-     * @param array                                $config
33
-     * @param \Illuminate\Cache\CacheManager       $cache
34
-     * @param \Illuminate\Database\DatabaseManager $db
35 31
      */
36 32
     public function __construct(array $data)
37 33
     {
38 34
         $this->data = $data;
39 35
     }
40 36
 
37
+    /**
38
+     * @param string $key
39
+     */
41 40
     public function get($key = null, $default = null)
42 41
     {
43 42
         $array = $this->data;
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -12,9 +12,6 @@
 block discarded – undo
12 12
 
13 13
 use Illuminate\Cache\CacheManager as Cache;
14 14
 use Illuminate\Database\DatabaseManager as Database;
15
-use Illuminate\Http\Request;
16
-use Illuminate\Support\Collection;
17
-use InvalidArgumentException;
18 15
 
19 16
 class Config
20 17
 {
Please login to merge, or discard this patch.
src/MultiLang/MultiLang.php 1 patch
Doc Comments   +13 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     /**
215 215
      * Get texts
216 216
      *
217
-     * @return array
217
+     * @return string|null
218 218
      */
219 219
     public function getRedirectUrl(Request $request)
220 220
     {
@@ -246,6 +246,9 @@  discard block
 block discarded – undo
246 246
         return null;
247 247
     }
248 248
 
249
+    /**
250
+     * @return string
251
+     */
249 252
     public function detectLocale(Request $request)
250 253
     {
251 254
         $locale  = $request->segment(1);
@@ -314,6 +317,9 @@  discard block
 block discarded – undo
314 317
         return $this;
315 318
     }
316 319
 
320
+    /**
321
+     * @param string|null $lang
322
+     */
317 323
     public function loadTextsFromDatabase($lang)
318 324
     {
319 325
         $texts = $lang ? $this->getDb()->table($this->getTableName())
@@ -334,6 +340,9 @@  discard block
 block discarded – undo
334 340
         return $texts;
335 341
     }
336 342
 
343
+    /**
344
+     * @param string $lang
345
+     */
337 346
     public function setCacheName($lang)
338 347
     {
339 348
         $this->cache_name = $this->config->get('db.texts_table') . '_' . $lang;
@@ -401,6 +410,9 @@  discard block
 block discarded – undo
401 410
         return true;
402 411
     }
403 412
 
413
+    /**
414
+     * @return string
415
+     */
404 416
     protected function getTableName()
405 417
     {
406 418
         $table = $this->config->get('db.texts_table', 'texts');
Please login to merge, or discard this patch.
src/MultiLang/Repository.php 3 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * Create a new MultiLang instance.
61 61
      *
62
-     * @param string                               $environment
63
-     * @param array                                $config
62
+     * @param Config                                $config
64 63
      * @param \Illuminate\Cache\CacheManager       $cache
65 64
      * @param \Illuminate\Database\DatabaseManager $db
66 65
      */
@@ -149,6 +148,9 @@  discard block
 block discarded – undo
149 148
     }
150 149
 
151 150
 
151
+    /**
152
+     * @return string
153
+     */
152 154
     protected function getTableName()
153 155
     {
154 156
         $table = $this->config->get('db.texts_table', 'texts');
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -12,9 +12,6 @@
 block discarded – undo
12 12
 
13 13
 use Illuminate\Cache\CacheManager as Cache;
14 14
 use Illuminate\Database\DatabaseManager as Database;
15
-use Illuminate\Http\Request;
16
-use Illuminate\Support\Collection;
17
-use InvalidArgumentException;
18 15
 use Longman\LaravelMultiLang\Config;
19 16
 
20 17
 class Repository
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
      */
67 67
     public function __construct(Config $config, Cache $cache, Database $db)
68 68
     {
69
-        $this->config       = $config;
69
+        $this->config = $config;
70 70
         $this->cache       = $cache;
71 71
         $this->db          = $db;
72 72
 
Please login to merge, or discard this patch.