Test Setup Failed
Push — master ( 9c038b...8387ac )
by Avtandil
04:09
created
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/MultiLang.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -288,9 +288,9 @@
 block discarded – undo
288 288
 
289 289
         foreach ($locales as $locale => $val) {
290 290
             $router->group([
291
-                               'prefix' => $locale,
292
-                               'as'     => $locale . '.',
293
-                           ], $callback);
291
+                                'prefix' => $locale,
292
+                                'as'     => $locale . '.',
293
+                            ], $callback);
294 294
         }
295 295
 
296 296
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@
 block discarded – undo
263 263
      */
264 264
     protected function sortReplacements(array $replace)
265 265
     {
266
-        return (new Collection($replace))->sortBy(function ($value, $key) {
266
+        return (new Collection($replace))->sortBy(function($value, $key) {
267 267
             return mb_strlen($key) * -1;
268 268
         });
269 269
     }
Please login to merge, or discard this patch.
src/MultiLang/Repository.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -203,11 +203,11 @@
 block discarded – undo
203 203
                 $this->getDb()
204 204
                     ->table($table)
205 205
                     ->insert([
206
-                                 'key'   => $k,
207
-                                 'lang'  => $lang,
208
-                                 'scope' => $scope,
209
-                                 'value' => $v,
210
-                             ]);
206
+                                    'key'   => $k,
207
+                                    'lang'  => $lang,
208
+                                    'scope' => $scope,
209
+                                    'value' => $v,
210
+                                ]);
211 211
             }
212 212
         }
213 213
         return true;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             ->where('lang', $lang);
81 81
 
82 82
         if (!is_null($scope)) {
83
-            $query = $query->whereNested(function ($query) use ($scope) {
83
+            $query = $query->whereNested(function($query) use ($scope) {
84 84
                 $query->where('scope', 'global');
85 85
                 $query->orWhere('scope', $scope);
86 86
             });
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         }
114 114
 
115 115
         if (!is_null($scope)) {
116
-            $query = $query->whereNested(function ($query) use ($scope) {
116
+            $query = $query->whereNested(function($query) use ($scope) {
117 117
                 $query->where('scope', 'global');
118 118
                 $query->orWhere('scope', $scope);
119 119
             });
Please login to merge, or discard this patch.
src/MultiLang/Console/MigrationCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $table = Config::get('multilang.db.texts_table');
40 40
 
41 41
         if ('' == $table) {
42
-            $this->error('Couldn\'t create migration.'.PHP_EOL.'Table name can\'t be empty. Check your configuration.');
42
+            $this->error('Couldn\'t create migration.' . PHP_EOL . 'Table name can\'t be empty. Check your configuration.');
43 43
 
44 44
             return;
45 45
         }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                 $this->info('Migration successfully created!');
61 61
             } else {
62 62
                 $this->error(
63
-                    'Couldn\'t create migration.'.PHP_EOL.' Check the write permissions
63
+                    'Couldn\'t create migration.' . PHP_EOL . ' Check the write permissions
64 64
                     within the database/migrations directory.'
65 65
                 );
66 66
             }
Please login to merge, or discard this patch.
src/MultiLang/Console/ExportCommand.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -168,6 +168,7 @@  discard block
 block discarded – undo
168 168
     /**
169 169
      * Get a texts from file.
170 170
      *
171
+     * @param string $scope
171 172
      * @return array
172 173
      */
173 174
     protected function getTextsFromFile($scope)
@@ -189,6 +190,7 @@  discard block
 block discarded – undo
189 190
     /**
190 191
      * Get a texts from database.
191 192
      *
193
+     * @param string $scope
192 194
      * @return array
193 195
      */
194 196
     protected function getTextsFromDb($scope)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
         $this->db    = $this->getDatabase();
85 85
 
86 86
         $lang = $this->option('lang');
87
-        if (! empty($lang)) {
87
+        if (!empty($lang)) {
88 88
             $this->langs = explode(',', $lang);
89 89
         }
90 90
 
91 91
         $scopes = $this->scopes;
92 92
         $scope  = $this->option('scope');
93
-        if (! empty($scope)) {
93
+        if (!empty($scope)) {
94 94
             $scopes = explode(',', $scope);
95 95
             foreach ($scopes as $scope) {
96
-                if (! in_array($scope, $this->scopes)) {
96
+                if (!in_array($scope, $this->scopes)) {
97 97
                     throw new InvalidArgumentException('Scope "' . $scope . '" is not found! Available scopes is ' . implode(', ', $this->scopes));
98 98
                 }
99 99
             }
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 
102 102
         $path       = $this->option('path', 'storage/multilang');
103 103
         $this->path = base_path($path);
104
-        if (! is_dir($this->path)) {
104
+        if (!is_dir($this->path)) {
105 105
             throw new InvalidArgumentException('Folder "' . $this->path . '" is not accessible!');
106 106
         }
107
-        if (! is_writable($this->path)) {
107
+        if (!is_writable($this->path)) {
108 108
             throw new InvalidArgumentException('Folder "' . $this->path . '" is not writable!');
109 109
         }
110 110
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $dbTexts = $this->getTextsFromDb($scope);
149 149
 
150
-        $fileTexts = ! $clear ? $this->getTextsFromFile($scope) : [];
150
+        $fileTexts = !$clear ? $this->getTextsFromFile($scope) : [];
151 151
 
152 152
         $textsToWrite = $force ? array_replace_recursive($fileTexts, $dbTexts) : array_replace_recursive($dbTexts, $fileTexts);
153 153
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
         $path    = $this->path . '/' . $scope . '.yml';
160 160
         $written = file_put_contents($path, $yaml);
161
-        if (! $written) {
161
+        if (!$written) {
162 162
             $this->error('Export texts of "' . $scope . '" is failed!');
163 163
         }
164 164
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         foreach ($dbTexts as $text) {
203 203
             $key  = $text->key;
204 204
             $lang = $text->lang;
205
-            if (! isset($formattedDbTexts[$key])) {
205
+            if (!isset($formattedDbTexts[$key])) {
206 206
                 $formattedDbTexts[$key] = ['key' => $key];
207 207
             }
208 208
             $formattedDbTexts[$key]['texts'][$lang] = $text->value;
Please login to merge, or discard this patch.
src/MultiLang/Console/ImportCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
         $this->db    = $this->getDatabase();
84 84
 
85 85
         $lang = $this->option('lang');
86
-        if (! empty($lang)) {
86
+        if (!empty($lang)) {
87 87
             $this->langs = explode(',', $lang);
88 88
         }
89 89
 
90 90
         $scopes = $this->scopes;
91 91
         $scope  = $this->option('scope');
92
-        if (! empty($scope)) {
92
+        if (!empty($scope)) {
93 93
             $scopes = explode(',', $scope);
94 94
             foreach ($scopes as $scope) {
95
-                if (! in_array($scope, $this->scopes)) {
95
+                if (!in_array($scope, $this->scopes)) {
96 96
                     throw new InvalidArgumentException('Scope "' . $scope . '" is not found! Available scopes is ' . implode(', ', $this->scopes));
97 97
                 }
98 98
             }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         $path       = $this->option('path', 'storage/multilang');
102 102
         $this->path = base_path($path);
103
-        if (! is_dir($this->path)) {
103
+        if (!is_dir($this->path)) {
104 104
             throw new InvalidArgumentException('Folder "' . $this->path . '" is not accessible!');
105 105
         }
106 106
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     protected function import($scope = 'global', $force = false)
114 114
     {
115 115
         $path = $this->path . '/' . $scope . '.yml';
116
-        if (! is_readable($path)) {
116
+        if (!is_readable($path)) {
117 117
             $this->warn('File "' . $path . '" is not readable!');
118 118
             return false;
119 119
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             $key = $text['key'];
132 132
 
133 133
             foreach ($text['texts'] as $lang => $value) {
134
-                if (! empty($this->langs) && ! in_array($lang, $this->langs)) {
134
+                if (!empty($this->langs) && !in_array($lang, $this->langs)) {
135 135
                     continue;
136 136
                 }
137 137
 
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
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
         );
50 50
 
51 51
         // Register blade directives
52
-        Blade::directive('t', function ($expression) {
52
+        Blade::directive('t', function($expression) {
53 53
             return "<?php echo e(t({$expression})); ?>";
54 54
         });
55 55
 
56
-        $this->app['events']->listen(RouteMatched::class, function () {
56
+        $this->app['events']->listen(RouteMatched::class, function() {
57 57
             $scope = $this->app['config']->get('app.scope');
58 58
             if ($scope && $scope != 'global') {
59 59
                 $this->app['multilang']->setScope($scope);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $configPath = __DIR__ . '/../config/config.php';
75 75
         $this->mergeConfigFrom($configPath, 'debugbar');
76 76
 
77
-        $this->app->singleton('multilang', function ($app) {
77
+        $this->app->singleton('multilang', function($app) {
78 78
             $environment = $app->environment();
79 79
             $config      = $app['config']->get('multilang');
80 80
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             );
87 87
 
88 88
             if ($multilang->autoSaveIsAllowed()) {
89
-                $app->terminating(function () use ($multilang) {
89
+                $app->terminating(function() use ($multilang) {
90 90
                     $scope = $this->app['config']->get('app.scope');
91 91
                     if ($scope && $scope != 'global') {
92 92
                         $multilang->setScope($scope);
@@ -102,28 +102,28 @@  discard block
 block discarded – undo
102 102
 
103 103
         $this->app->singleton(
104 104
             'command.multilang.migration',
105
-            function () {
105
+            function() {
106 106
                 return new MigrationCommand();
107 107
             }
108 108
         );
109 109
 
110 110
         $this->app->singleton(
111 111
             'command.multilang.texts',
112
-            function () {
112
+            function() {
113 113
                 return new TextsCommand();
114 114
             }
115 115
         );
116 116
 
117 117
         $this->app->singleton(
118 118
             'command.multilang.import',
119
-            function () {
119
+            function() {
120 120
                 return new ImportCommand();
121 121
             }
122 122
         );
123 123
 
124 124
         $this->app->singleton(
125 125
             'command.multilang.export',
126
-            function () {
126
+            function() {
127 127
                 return new ExportCommand();
128 128
             }
129 129
         );
Please login to merge, or discard this patch.