Passed
Pull Request — 2.x (#990)
by Antonio Carlos
06:29
created
src/Services/Assets/Twill.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
     private function readManifest()
70 70
     {
71 71
         try {
72
-            return Cache::rememberForever('twill-manifest', function () {
72
+            return Cache::rememberForever('twill-manifest', function() {
73 73
                 return $this->readJson($this->getManifestFilename());
74 74
             });
75 75
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/Services/Routing/HasRoutes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         $routesFile
18 18
     ) {
19 19
         if (file_exists($routesFile)) {
20
-            $hostRoutes = function ($router) use (
20
+            $hostRoutes = function($router) use (
21 21
                 $middlewares,
22 22
                 $namespace,
23 23
                 $routesFile
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
                         'namespace' => $namespace,
28 28
                         'middleware' => $middlewares,
29 29
                     ],
30
-                    function ($router) use ($routesFile) {
30
+                    function($router) use ($routesFile) {
31 31
                         require $routesFile;
32 32
                     }
33 33
                 );
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $manager = (new Manager());
127 127
 
128 128
         $manager->getCapsuleList()
129
-                ->each(function ($capsule) use ($router, $manager) {
129
+                ->each(function($capsule) use ($router, $manager) {
130 130
                     $this->registerCapsuleRoutes($router, $capsule, $manager);
131 131
                 });
132 132
     }
Please login to merge, or discard this patch.
src/Services/Blocks/Block.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -235,14 +235,14 @@
 block discarded – undo
235 235
             return $value;
236 236
         }
237 237
 
238
-        if ($configBlock = collect(config("twill.block_editor.blocks"))->filter(function ($block) use ($blockName) {
238
+        if ($configBlock = collect(config("twill.block_editor.blocks"))->filter(function($block) use ($blockName) {
239 239
             return Str::contains($block['component'], $blockName);
240 240
         })->first()) {
241 241
             if ($value = ($configBlock[$property] ?? null)) {
242 242
                 return $value;
243 243
             }
244 244
         }
245
-        if ($configRepeater = collect(config("twill.block_editor.repeaters"))->filter(function ($repeater) use ($blockName) {
245
+        if ($configRepeater = collect(config("twill.block_editor.repeaters"))->filter(function($repeater) use ($blockName) {
246 246
             return Str::contains($repeater['component'], $blockName);
247 247
         })->first()) {
248 248
             if ($value = ($configRepeater[$property] ?? null)) {
Please login to merge, or discard this patch.
src/Services/Blocks/BlockCollection.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
     public function findByName($search, $sources = [])
53 53
     {
54 54
         return $this->collect()
55
-            ->filter(function ($block) use ($search, $sources) {
55
+            ->filter(function($block) use ($search, $sources) {
56 56
                 return $block->name == $search &&
57 57
                     (blank($sources) ||
58 58
                     collect($sources)->contains($block->source));
59 59
             })
60
-            ->sortBy(function ($block) {
60
+            ->sortBy(function($block) {
61 61
                 return $block->source === 'app' ? 0 : 1;
62 62
             })
63 63
             ->first();
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     public function getBlocks()
70 70
     {
71 71
         return $this->collect()
72
-            ->filter(function ($block) {
72
+            ->filter(function($block) {
73 73
                 return $block->type === Block::TYPE_BLOCK;
74 74
             })
75 75
             ->values();
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function getBlockList()
82 82
     {
83
-        return $this->getBlocks()->map(function (Block $block) {
83
+        return $this->getBlocks()->map(function(Block $block) {
84 84
             return $block->toList();
85 85
         });
86 86
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         return collect($this->fileSystem->files($directory))
111
-            ->map(function ($file) use ($source, $type) {
111
+            ->map(function($file) use ($source, $type) {
112 112
                 return new Block($file, $type, $source);
113 113
             });
114 114
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $this->paths = collect(
122 122
             config('twill.block_editor.directories.source.blocks')
123 123
         )
124
-            ->map(function ($path) {
124
+            ->map(function($path) {
125 125
                 $path['type'] = Block::TYPE_BLOCK;
126 126
 
127 127
                 return $path;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             ->merge(
130 130
                 collect(
131 131
                     config('twill.block_editor.directories.source.repeaters')
132
-                )->map(function ($path) {
132
+                )->map(function($path) {
133 133
                     $path['type'] = Block::TYPE_REPEATER;
134 134
 
135 135
                     return $path;
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
         $this->generatePaths();
168 168
 
169 169
         $this->items = collect($this->paths)
170
-            ->reduce(function (Collection $keep, $path) {
170
+            ->reduce(function(Collection $keep, $path) {
171 171
                 $this->readBlocks(
172 172
                     $path['path'],
173 173
                     $path['source'],
174 174
                     $path['type']
175
-                )->each(function ($block) use ($keep) {
175
+                )->each(function($block) use ($keep) {
176 176
                     $keep->push($block);
177 177
 
178 178
                     return $keep;
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
             ->toArray();
184 184
 
185 185
         $this->items = $this->collect()
186
-            ->each(function (Block $block) {
186
+            ->each(function(Block $block) {
187 187
                 $block->setSource($this->detectCustomSources($block));
188 188
             })
189 189
             ->toArray();
190 190
 
191 191
         // remove duplicate Twill blocks
192 192
         $appBlocks = $this->collect()->whereIn('source', [Block::SOURCE_APP, Block::SOURCE_CUSTOM]);
193
-        $this->items = $this->collect()->filter(function ($item) use ($appBlocks) {
194
-            return !$appBlocks->contains(function ($block) use ($item) {
193
+        $this->items = $this->collect()->filter(function($item) use ($appBlocks) {
194
+            return !$appBlocks->contains(function($block) use ($item) {
195 195
                 return $item->source === Block::SOURCE_TWILL && $item->name === $block->name;
196 196
             });
197 197
         })->values()->toArray();
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public function addBlocksFromConfig(Collection $items, $type)
216 216
     {
217
-        $items->reject(function ($value, $blockName) use ($type) {
218
-            return $this->contains(function ($block) use ($blockName, $type) {
217
+        $items->reject(function($value, $blockName) use ($type) {
218
+            return $this->contains(function($block) use ($blockName, $type) {
219 219
                 return $block->name === $blockName && $block->type === $type;
220 220
             }) ? [$blockName, $value] : false;
221 221
         })
222
-            ->each(function ($block, $blockName) use ($type) {
222
+            ->each(function($block, $blockName) use ($type) {
223 223
                 if ($block['compiled'] ?? false) {
224 224
                     $file = null;
225 225
                 } else {
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function logDeprecatedBlockConfig($blockName, $type)
262 262
     {
263
-        $path = $this->paths->filter(function ($path) use ($type) {
263
+        $path = $this->paths->filter(function($path) use ($type) {
264 264
             return $path['source'] === Block::SOURCE_APP && $path['type'] === $type;
265 265
         })->pluck('path')->join(', ', ' or ');
266 266
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     public function findFileByComponentName($componentName)
283 283
     {
284 284
         $filename = str_replace('a17-block-', '', $componentName) . '.blade.php';
285
-        $paths = $this->paths->pluck('path')->filter(function ($path) {
285
+        $paths = $this->paths->pluck('path')->filter(function($path) {
286 286
             return $this->fileSystem->exists($path);
287 287
         })->toArray();
288 288
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function list()
310 310
     {
311
-        return $this->collect()->map(function (Block $block) {
311
+        return $this->collect()->map(function(Block $block) {
312 312
             return $block->toList();
313 313
         });
314 314
     }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
     public function getRepeaters()
328 328
     {
329 329
         return $this->collect()
330
-            ->filter(function ($block) {
330
+            ->filter(function($block) {
331 331
                 return $block->type === Block::TYPE_REPEATER;
332 332
             })
333 333
             ->values();
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
      */
339 339
     public function getRepeaterList()
340 340
     {
341
-        return $this->getRepeaters()->map(function (Block $block) {
341
+        return $this->getRepeaters()->map(function(Block $block) {
342 342
             return $block->toList();
343 343
         });
344 344
     }
Please login to merge, or discard this patch.
src/RouteServiceProvider.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
         $middlewares,
83 83
         $supportSubdomainRouting
84 84
     ) {
85
-        $internalRoutes = function ($router) use (
85
+        $internalRoutes = function($router) use (
86 86
             $middlewares,
87 87
             $supportSubdomainRouting
88 88
         ) {
89
-            $router->group(['middleware' => $middlewares], function ($router) {
89
+            $router->group(['middleware' => $middlewares], function($router) {
90 90
                 require __DIR__ . '/../routes/admin.php';
91 91
             });
92 92
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                     ? ['supportSubdomainRouting']
97 97
                     : [],
98 98
                 ],
99
-                function ($router) {
99
+                function($router) {
100 100
                     require __DIR__ . '/../routes/auth.php';
101 101
                 }
102 102
             );
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     ? ['twill_auth:twill_users']
108 108
                     : [],
109 109
                 ],
110
-                function ($router) {
110
+                function($router) {
111 111
                     require __DIR__ . '/../routes/templates.php';
112 112
                 }
113 113
             );
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             $groupOptions + [
118 118
                 'namespace' => $this->namespace . '\Admin',
119 119
             ],
120
-            function ($router) use ($internalRoutes, $supportSubdomainRouting) {
120
+            function($router) use ($internalRoutes, $supportSubdomainRouting) {
121 121
                 $router->group(
122 122
                     [
123 123
                         'domain' => config('twill.admin_app_url'),
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                         config('twill.admin_middleware_group', 'web'),
149 149
                     ],
150 150
                 ],
151
-                function ($router) {
151
+                function($router) {
152 152
                     $router->group(
153 153
                         [
154 154
                             'middleware' => $this->app->environment(
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                             ? ['twill_auth:twill_users']
158 158
                             : [],
159 159
                         ],
160
-                        function ($router) {
160
+                        function($router) {
161 161
                             require __DIR__ . '/../routes/templates.php';
162 162
                         }
163 163
                     );
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     protected function registerMacros()
212 212
     {
213
-        Route::macro('moduleShowWithPreview', function (
213
+        Route::macro('moduleShowWithPreview', function(
214 214
             $moduleName,
215 215
             $routePrefix = null,
216 216
             $controllerName = null
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                 ->middleware(['web', 'twill_auth:twill_users', 'can:list']);
245 245
         });
246 246
 
247
-        Route::macro('module', function (
247
+        Route::macro('module', function(
248 248
             $slug,
249 249
             $options = [],
250 250
             $resource_options = [],
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             $_slug = Arr::last($slugs);
256 256
             $className = implode(
257 257
                 '',
258
-                array_map(function ($s) {
258
+                array_map(function($s) {
259 259
                     return ucfirst(Str::singular($s));
260 260
                 }, $slugs)
261 261
             );
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             if ($resource) {
381 381
                 Route::group(
382 382
                     ['as' => $resourceCustomGroupPrefix],
383
-                    function () use ($slug, $className, $resource_options) {
383
+                    function() use ($slug, $className, $resource_options) {
384 384
                         Route::resource(
385 385
                             $slug,
386 386
                             "{$className}Controller",
Please login to merge, or discard this patch.
src/Models/Behaviors/HasMedias.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     private function findMedia($role, $crop = "default")
39 39
     {
40
-        $media = $this->medias->first(function ($media) use ($role, $crop) {
40
+        $media = $this->medias->first(function($media) use ($role, $crop) {
41 41
             if (config('twill.media_library.translated_form_fields', false)) {
42 42
                 $localeScope = $media->pivot->locale === app()->getLocale();
43 43
             }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         });
47 47
 
48 48
         if (!$media && config('twill.media_library.translated_form_fields', false)) {
49
-            $media = $this->medias->first(function ($media) use ($role, $crop) {
49
+            $media = $this->medias->first(function($media) use ($role, $crop) {
50 50
                 return $media->pivot->role === $role && $media->pivot->crop === $crop;
51 51
             });
52 52
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
     public function images($role, $crop = "default", $params = [])
91 91
     {
92
-        $medias = $this->medias->filter(function ($media) use ($role, $crop) {
92
+        $medias = $this->medias->filter(function($media) use ($role, $crop) {
93 93
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
94 94
         });
95 95
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
     public function imagesWithCrops($role, $params = [])
106 106
     {
107
-        $medias = $this->medias->filter(function ($media) use ($role) {
107
+        $medias = $this->medias->filter(function($media) use ($role) {
108 108
             return $media->pivot->role === $role;
109 109
         });
110 110
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
     public function imagesAsArrays($role, $crop = "default", $params = [])
142 142
     {
143
-        $medias = $this->medias->filter(function ($media) use ($role, $crop) {
143
+        $medias = $this->medias->filter(function($media) use ($role, $crop) {
144 144
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
145 145
         });
146 146
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
     public function imagesAsArraysWithCrops($role, $params = [])
157 157
     {
158
-        $medias = $this->medias->filter(function ($media) use ($role) {
158
+        $medias = $this->medias->filter(function($media) use ($role) {
159 159
             return $media->pivot->role === $role;
160 160
         });
161 161
 
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
     public function imageAltText($role, $media = null)
173 173
     {
174 174
         if (!$media) {
175
-            $media = $this->medias->first(function ($media) use ($role) {
175
+            $media = $this->medias->first(function($media) use ($role) {
176 176
                 if (config('twill.media_library.translated_form_fields', false)) {
177 177
                     $localeScope = $media->pivot->locale === app()->getLocale();
178 178
                 }
179 179
 
180
-                return $media->pivot->role === $role && ($localeScope ?? true);;
180
+                return $media->pivot->role === $role && ($localeScope ?? true); ;
181 181
             });
182 182
         }
183 183
 
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
     public function imageCaption($role, $media = null)
192 192
     {
193 193
         if (!$media) {
194
-            $media = $this->medias->first(function ($media) use ($role) {
194
+            $media = $this->medias->first(function($media) use ($role) {
195 195
                 if (config('twill.media_library.translated_form_fields', false)) {
196 196
                     $localeScope = $media->pivot->locale === app()->getLocale();
197 197
                 }
198 198
 
199
-                return $media->pivot->role === $role && ($localeScope ?? true);;
199
+                return $media->pivot->role === $role && ($localeScope ?? true); ;
200 200
             });
201 201
         }
202 202
 
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
     public function imageVideo($role, $media = null)
211 211
     {
212 212
         if (!$media) {
213
-            $media = $this->medias->first(function ($media) use ($role) {
213
+            $media = $this->medias->first(function($media) use ($role) {
214 214
                 if (config('twill.media_library.translated_form_fields', false)) {
215 215
                     $localeScope = $media->pivot->locale === app()->getLocale();
216 216
                 }
217 217
 
218
-                return $media->pivot->role === $role && ($localeScope ?? true);;
218
+                return $media->pivot->role === $role && ($localeScope ?? true); ;
219 219
             });
220 220
         }
221 221
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
     public function imageObjects($role, $crop = "default")
286 286
     {
287
-        return $this->medias->filter(function ($media) use ($role, $crop) {
287
+        return $this->medias->filter(function($media) use ($role, $crop) {
288 288
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
289 289
         });
290 290
     }
Please login to merge, or discard this patch.
src/Services/Capsules/HasCapsules.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -366,9 +366,9 @@
 block discarded – undo
366 366
         }
367 367
 
368 368
         collect($files)->each(function ($file) {
369
-           if (file_exists($file)) {
370
-               require_once $file;
371
-           }
369
+            if (file_exists($file)) {
370
+                require_once $file;
371
+            }
372 372
         });
373 373
     }
374 374
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
         return $list
27 27
             ->where('enabled', true)
28
-            ->map(function ($capsule) use ($path) {
28
+            ->map(function($capsule) use ($path) {
29 29
                 return $this->makeCapsule($capsule, $path);
30 30
             });
31 31
     }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public function getCapsuleByModule($module)
41 41
     {
42 42
         return $this->getCapsuleList()
43
-            ->filter(function ($capsule) use ($module) {
43
+            ->filter(function($capsule) use ($module) {
44 44
                 return Str::lower($capsule['plural']) == Str::lower($module);
45 45
             })
46 46
             ->first();
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     {
255 255
         $twillSeeder = app(CapsuleSeeder::class);
256 256
 
257
-        $this->getCapsuleList()->each(function ($capsule) use (
257
+        $this->getCapsuleList()->each(function($capsule) use (
258 258
             $twillSeeder,
259 259
             $illuminateSeeder
260 260
         ) {
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             return;
366 366
         }
367 367
 
368
-        collect($files)->each(function ($file) {
368
+        collect($files)->each(function($file) {
369 369
            if (file_exists($file)) {
370 370
                require_once $file;
371 371
            }
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleBrowsers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         if (!empty($object->$relation)) {
127 127
             $fields = $object->$relation() instanceof BelongsTo ? collect([$object->$relation]) : $object->$relation;
128
-            return $fields->map(function ($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) {
128
+            return $fields->map(function($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) {
129 129
                 return [
130 130
                     'id' => $relatedElement->id,
131 131
                     'name' => $relatedElement->titleInBrowser ?? $relatedElement->$titleKey,
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function getFormFieldsForRelatedBrowser($object, $relation, $titleKey = 'title')
149 149
     {
150
-        return $object->getRelated($relation)->map(function ($relatedElement) use ($titleKey) {
150
+        return $object->getRelated($relation)->map(function($relatedElement) use ($titleKey) {
151 151
             return ($relatedElement != null) ? [
152 152
                 'id' => $relatedElement->id,
153 153
                 'name' => $relatedElement->titleInBrowser ?? $relatedElement->$titleKey,
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             ]) + (classHasTrait($relatedElement, HasMedias::class) ? [
158 158
                 'thumbnail' => $relatedElement->defaultCmsImage(['w' => 100, 'h' => 100]),
159 159
             ] : []) : [];
160
-        })->reject(function ($item) {
160
+        })->reject(function($item) {
161 161
             return empty($item);
162 162
         })->values()->toArray();
163 163
     }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     protected function getBrowsers()
172 172
     {
173
-        return collect($this->browsers)->map(function ($browser, $key) {
173
+        return collect($this->browsers)->map(function($browser, $key) {
174 174
             $browserName = is_string($browser) ? $browser : $key;
175 175
             $moduleName = !empty($browser['moduleName']) ? $browser['moduleName'] : $this->inferModuleNameFromBrowserName($browserName);
176 176
 
Please login to merge, or discard this patch.
src/CapsulesServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     public function registerCapsules()
43 43
     {
44
-        $this->manager->getCapsuleList()->map(function ($capsule) {
44
+        $this->manager->getCapsuleList()->map(function($capsule) {
45 45
             $this->registerCapsule($capsule);
46 46
         });
47 47
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function registerViewPaths()
55 55
     {
56 56
         if (file_exists(config('twill.capsules.path'))) {
57
-            $callback = function ($view) {
57
+            $callback = function($view) {
58 58
                 $view->addLocation(config('twill.capsules.path'));
59 59
             };
60 60
 
Please login to merge, or discard this patch.