Test Setup Failed
Push — master ( 5d4742...dadafa )
by Avtandil
11:52 queued 14s
created
src/MultiLang/Middleware/MultiLang.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function handle(Request $request, Closure $next)
50 50
     {
51
-        if (! $this->app->bound(MultiLangLib::class)) {
51
+        if (!$this->app->bound(MultiLangLib::class)) {
52 52
             return $next($request);
53 53
         }
54 54
         $multilang = $this->app->make(MultiLangLib::class);
55 55
 
56 56
         $url = $multilang->getRedirectUrl($request);
57 57
 
58
-        if (! empty($url)) {
58
+        if (!empty($url)) {
59 59
             if ($request->expectsJson()) {
60 60
                 return response('Not found', 404);
61 61
             } else {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         if ($multilang->getConfig()->get('set_system_locale')) {
75 75
             $locales = $multilang->getLocales();
76
-            if (! empty($locales[$locale]['full_locale'])) {
76
+            if (!empty($locales[$locale]['full_locale'])) {
77 77
                 setlocale(LC_ALL, $locales[$locale]['full_locale']);
78 78
             }
79 79
         }
Please login to merge, or discard this patch.
src/MultiLang/Models/LocalizableScope.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     public function apply(Builder $builder, Model $model)
21 21
     {
22 22
 
23
-        if (! $this->queryHasLocalizableColumn($builder)) {
23
+        if (!$this->queryHasLocalizableColumn($builder)) {
24 24
             $builder->where($model->getQualifiedLocalizableColumn(), '=', app()->getLocale());
25 25
         }
26 26
     }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $wheres = $builder->getQuery()->wheres;
37 37
         $column = $this->getLocalizableColumn($builder);
38
-        if (! empty($wheres)) {
38
+        if (!empty($wheres)) {
39 39
             foreach ($wheres as $where) {
40 40
                 if (isset($where['column']) && $where['column'] === $column) {
41 41
                     return true;
Please login to merge, or discard this patch.
src/MultiLang/MultiLangServiceProvider.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
         );
39 39
 
40 40
         // Register blade directives
41
-        $this->getBlade()->directive('t', static function ($expression) {
41
+        $this->getBlade()->directive('t', static function($expression) {
42 42
             return "<?php echo e(t({$expression})); ?>";
43 43
         });
44 44
 
45
-        $this->app['events']->listen(RouteMatched::class, function () {
45
+        $this->app['events']->listen(RouteMatched::class, function() {
46 46
             $scope = $this->app['config']->get('app.scope');
47 47
             if ($scope && $scope !== 'global') {
48 48
                 $this->app['multilang']->setScope($scope);
49 49
             }
50 50
         });
51 51
 
52
-        $this->app['events']->listen(LocaleUpdated::class, function ($event) {
52
+        $this->app['events']->listen(LocaleUpdated::class, function($event) {
53 53
             $this->app['multilang']->setLocale($event->locale);
54 54
         });
55 55
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $configPath = __DIR__ . '/../config/config.php';
67 67
         $this->mergeConfigFrom($configPath, 'multilang');
68 68
 
69
-        $this->app->singleton('multilang', function ($app) {
69
+        $this->app->singleton('multilang', function($app) {
70 70
             $environment = $app->environment();
71 71
             $config = $app['config']->get('multilang');
72 72
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             );
79 79
 
80 80
             if ($multilang->autoSaveIsAllowed()) {
81
-                $app->terminating(function () use ($multilang) {
81
+                $app->terminating(function() use ($multilang) {
82 82
                     $scope = $this->app['config']->get('app.scope');
83 83
                     if ($scope && $scope !== 'global') {
84 84
                         $multilang->setScope($scope);
@@ -95,28 +95,28 @@  discard block
 block discarded – undo
95 95
 
96 96
         $this->app->singleton(
97 97
             'command.multilang.migration',
98
-            static function () {
98
+            static function() {
99 99
                 return new MigrationCommand();
100 100
             }
101 101
         );
102 102
 
103 103
         $this->app->singleton(
104 104
             'command.multilang.texts',
105
-            static function () {
105
+            static function() {
106 106
                 return new TextsCommand();
107 107
             }
108 108
         );
109 109
 
110 110
         $this->app->singleton(
111 111
             'command.multilang.import',
112
-            static function () {
112
+            static function() {
113 113
                 return new ImportCommand();
114 114
             }
115 115
         );
116 116
 
117 117
         $this->app->singleton(
118 118
             'command.multilang.export',
119
-            static function () {
119
+            static function() {
120 120
                 return new ExportCommand();
121 121
             }
122 122
         );
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             ]
131 131
         );
132 132
 
133
-        $this->app->make('request')->macro('locale', static function () {
133
+        $this->app->make('request')->macro('locale', static function() {
134 134
             return app('multilang')->getLocale();
135 135
         });
136 136
     }
Please login to merge, or discard this patch.
src/MultiLang/MultiLang.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function setLocale(string $lang)
167 167
     {
168
-        if (! $lang) {
168
+        if (!$lang) {
169 169
             throw new InvalidArgumentException('Locale is empty');
170 170
         }
171 171
         $this->lang = $lang;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      */
218 218
     public function get(string $key, array $replacements = []): string
219 219
     {
220
-        if (! $this->getConfig()->get('use_texts', true)) {
220
+        if (!$this->getConfig()->get('use_texts', true)) {
221 221
             throw new InvalidArgumentException('Using texts from database is disabled in config');
222 222
         }
223 223
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
             throw new InvalidArgumentException('Text key not provided');
226 226
         }
227 227
 
228
-        if (! $this->lang) {
228
+        if (!$this->lang) {
229 229
             return $key;
230 230
         }
231 231
 
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
             $this->loadTexts();
235 235
         }
236 236
 
237
-        if (! isset($this->texts[$key])) {
237
+        if (!isset($this->texts[$key])) {
238 238
             $this->queueToSave($key);
239 239
         }
240 240
 
241
-        if (! empty($replacements)) {
241
+        if (!empty($replacements)) {
242 242
             $keys = array_keys($replacements);
243
-            $keys = array_map(static function ($v) {
243
+            $keys = array_map(static function($v) {
244 244
                 return ':' . $v;
245 245
             }, $keys);
246 246
             $replacements = array_combine($keys, $replacements);
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     public function getRedirectUrl(Request $request): string
259 259
     {
260 260
         $exclude_patterns = $this->config->get('exclude_segments', []);
261
-        if (! empty($exclude_patterns)) {
261
+        if (!empty($exclude_patterns)) {
262 262
             if (call_user_func_array([$request, 'is'], $exclude_patterns)) {
263 263
                 return '';
264 264
             }
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 
267 267
         $locale = $request->segment(1);
268 268
         $fallback_locale = $this->config->get('default_locale', 'en');
269
-        if (! empty($locale) && strlen($locale) === 2) {
269
+        if (!empty($locale) && strlen($locale) === 2) {
270 270
             $locales = $this->config->get('locales', []);
271 271
 
272
-            if (! isset($locales[$locale])) {
272
+            if (!isset($locales[$locale])) {
273 273
                 $segments = $request->segments();
274 274
                 $segments[0] = $fallback_locale;
275 275
                 $url = implode('/', $segments);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
         // Remove domain from path
415 415
         $app_url = config('app.url', '');
416
-        if (! empty($app_url) && mb_substr($lang_path, 0, mb_strlen($app_url)) === $app_url) {
416
+        if (!empty($app_url) && mb_substr($lang_path, 0, mb_strlen($app_url)) === $app_url) {
417 417
             $lang_path = ltrim(str_replace($app_url, '', $lang_path), '/');
418 418
         }
419 419
 
Please login to merge, or discard this patch.
src/MultiLang/Repository.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     public function getCacheName(string $lang, ?string $scope = null): string
58 58
     {
59 59
         $key = $this->config->get('db.texts_table', 'texts') . '_' . $lang;
60
-        if (! is_null($scope)) {
60
+        if (!is_null($scope)) {
61 61
             $key .= '_' . $scope;
62 62
         }
63 63
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
         $query = $this->getDb()->table($this->getTableName())
77 77
             ->where('lang', $lang);
78 78
 
79
-        if (! is_null($scope) && $scope !== 'global') {
80
-            $query = $query->whereNested(static function ($query) use ($scope) {
79
+        if (!is_null($scope) && $scope !== 'global') {
80
+            $query = $query->whereNested(static function($query) use ($scope) {
81 81
                 $query->where('scope', 'global');
82 82
                 $query->orWhere('scope', $scope);
83 83
             });
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $query = $this->getDb()->table($this->getTableName());
108 108
 
109
-        if (! is_null($lang)) {
109
+        if (!is_null($lang)) {
110 110
             $query = $query->where('lang', $lang);
111 111
         }
112 112
 
113
-        if (! is_null($scope)) {
114
-            $query = $query->whereNested(static function ($query) use ($scope) {
113
+        if (!is_null($scope)) {
114
+            $query = $query->whereNested(static function($query) use ($scope) {
115 115
                 $query->where('scope', 'global');
116 116
                 $query->orWhere('scope', $scope);
117 117
             });
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
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
         $this->db = $this->getDatabase();
81 81
 
82 82
         $lang = $this->option('lang');
83
-        if (! empty($lang)) {
83
+        if (!empty($lang)) {
84 84
             $this->langs = explode(',', $lang);
85 85
         }
86 86
 
87 87
         $scopes = $this->scopes;
88 88
         $scope = $this->option('scope');
89
-        if (! empty($scope)) {
89
+        if (!empty($scope)) {
90 90
             $scopes = explode(',', $scope);
91 91
             foreach ($scopes as $scope) {
92
-                if (! in_array($scope, $this->scopes)) {
92
+                if (!in_array($scope, $this->scopes)) {
93 93
                     throw new InvalidArgumentException('Scope "' . $scope . '" is not found! Available scopes is ' . implode(', ', $this->scopes));
94 94
                 }
95 95
             }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
         $path = $this->option('path', 'storage/multilang');
99 99
         $this->path = base_path($path);
100
-        if (! is_dir($this->path)) {
100
+        if (!is_dir($this->path)) {
101 101
             throw new InvalidArgumentException('Folder "' . $this->path . '" is not accessible!');
102 102
         }
103 103
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     protected function import(string $scope = 'global', bool $force = false, bool $clear = false)
112 112
     {
113 113
         $path = $this->path . '/' . $scope . '.yml';
114
-        if (! is_readable($path)) {
114
+        if (!is_readable($path)) {
115 115
             $this->warn('File "' . $path . '" is not readable!');
116 116
 
117 117
             return false;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             $key = $text['key'];
139 139
 
140 140
             foreach ($text['texts'] as $lang => $value) {
141
-                if (! empty($this->langs) && ! in_array($lang, $this->langs)) {
141
+                if (!empty($this->langs) && !in_array($lang, $this->langs)) {
142 142
                     continue;
143 143
                 }
144 144
 
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 declare(strict_types=1);
4 4
 
5
-if (! function_exists('lang_url')) {
5
+if (!function_exists('lang_url')) {
6 6
     /**
7 7
      * Generate a url for the application.
8 8
      *
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     }
27 27
 }
28 28
 
29
-if (! function_exists('lang_redirect')) {
29
+if (!function_exists('lang_redirect')) {
30 30
     /**
31 31
      * Get an instance of the redirector.
32 32
      *
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     }
51 51
 }
52 52
 
53
-if (! function_exists('lang_route')) {
53
+if (!function_exists('lang_route')) {
54 54
     /**
55 55
      * Get route by name
56 56
      *
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     }
70 70
 }
71 71
 
72
-if (! function_exists('t')) {
72
+if (!function_exists('t')) {
73 73
     /**
74 74
      * Get translated text
75 75
      *
Please login to merge, or discard this patch.