Passed
Pull Request — 2.x (#597)
by Antonio Carlos
06:56
created
src/Http/Controllers/Admin/IconsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
             abort(404);
21 21
         }
22 22
 
23
-        return response()->stream(function () use ($file) {
23
+        return response()->stream(function() use ($file) {
24 24
             echo $this->files->get($file);
25 25
         });
26 26
     }
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/ModuleController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             "$this->viewPrefix.index",
331 331
             "twill::$this->moduleName.index",
332 332
             "twill::layouts.listing",
333
-        ])->first(function ($view) {
333
+        ])->first(function($view) {
334 334
             return View::exists($view);
335 335
         });
336 336
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
             "$this->viewPrefix.form",
422 422
             "twill::$this->moduleName.form",
423 423
             "twill::layouts.form",
424
-        ])->first(function ($view) {
424
+        ])->first(function($view) {
425 425
             return View::exists($view);
426 426
         });
427 427
 
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
             "$this->viewPrefix.form",
538 538
             "twill::$this->moduleName.form",
539 539
             "twill::layouts.form",
540
-        ])->first(function ($view) {
540
+        ])->first(function($view) {
541 541
             return View::exists($view);
542 542
         });
543 543
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
         $query = $this->request->input('q');
785 785
         $tags = $this->repository->getTags($query);
786 786
 
787
-        return Response::json(['items' => $tags->map(function ($tag) {
787
+        return Response::json(['items' => $tags->map(function($tag) {
788 788
             return $tag->name;
789 789
         })], 200);
790 790
     }
@@ -871,8 +871,8 @@  discard block
 block discarded – undo
871 871
     protected function getIndexTableData($items)
872 872
     {
873 873
         $translated = $this->moduleHas('translations');
874
-        return $items->map(function ($item) use ($translated) {
875
-            $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function ($column) use ($item) {
874
+        return $items->map(function($item) use ($translated) {
875
+            $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function($column) use ($item) {
876 876
                 return $this->getItemColumnData($item, $column);
877 877
             })->toArray();
878 878
 
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
             'feature',
1130 1130
             'bulkFeature',
1131 1131
             'bulkDelete',
1132
-        ])->mapWithKeys(function ($endpoint) {
1132
+        ])->mapWithKeys(function($endpoint) {
1133 1133
             return [
1134 1134
                 $endpoint . 'Url' => $this->getIndexOption($endpoint) ? moduleRoute(
1135 1135
                     $this->moduleName, $this->routePrefix, $endpoint,
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
      */
1146 1146
     protected function getIndexOption($option)
1147 1147
     {
1148
-        return once(function () use ($option) {
1148
+        return once(function() use ($option) {
1149 1149
             $customOptionNamesMapping = [
1150 1150
                 'store' => 'create',
1151 1151
             ];
@@ -1201,8 +1201,8 @@  discard block
 block discarded – undo
1201 1201
     {
1202 1202
         $withImage = $this->moduleHas('medias');
1203 1203
 
1204
-        return $items->map(function ($item) use ($withImage) {
1205
-            $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function ($column) use ($item) {
1204
+        return $items->map(function($item) use ($withImage) {
1205
+            $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function($column) use ($item) {
1206 1206
                 return $this->getItemColumnData($item, $column);
1207 1207
             })->toArray();
1208 1208
 
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
                     $fieldSplitted = explode('|', $field);
1269 1269
                     if (count($fieldSplitted) > 1) {
1270 1270
                         $requestValue = $requestFilters[$key];
1271
-                        Collection::make($fieldSplitted)->each(function ($scopeKey) use (&$scope, $requestValue) {
1271
+                        Collection::make($fieldSplitted)->each(function($scopeKey) use (&$scope, $requestValue) {
1272 1272
                             $scope[$scopeKey] = $requestValue;
1273 1273
                         });
1274 1274
                     } else {
@@ -1435,11 +1435,11 @@  discard block
 block discarded – undo
1435 1435
      */
1436 1436
     protected function validateFormRequest()
1437 1437
     {
1438
-        $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function ($permission, $field) {
1438
+        $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function($permission, $field) {
1439 1439
             return Auth::guard('twill_users')->user()->cannot($permission);
1440 1440
         })->keys();
1441 1441
 
1442
-        $unauthorizedFields->each(function ($field) {
1442
+        $unauthorizedFields->each(function($field) {
1443 1443
             $this->request->offsetUnset($field);
1444 1444
         });
1445 1445
 
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
      */
1680 1680
     public function getRepeaterList()
1681 1681
     {
1682
-        return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function ($repeater) {
1682
+        return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function($repeater) {
1683 1683
             return [$repeater['name'] => $repeater];
1684 1684
         });
1685 1685
     }
Please login to merge, or discard this patch.
src/Services/Blocks/BlockCollection.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
     public function findByName($search, $sources = [])
51 51
     {
52 52
         return $this->collect()
53
-            ->filter(function ($block) use ($search, $sources) {
53
+            ->filter(function($block) use ($search, $sources) {
54 54
                 return $block->name == $search &&
55 55
                     (blank($sources) ||
56 56
                         collect($sources)->contains($block->source));
57 57
             })
58
-            ->sortBy(function ($block) {
58
+            ->sortBy(function($block) {
59 59
                 return $block->source === 'app' ? 0 : 1;
60 60
             })
61 61
             ->first();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public function getBlocks()
68 68
     {
69 69
         return $this->collect()
70
-            ->filter(function ($block) {
70
+            ->filter(function($block) {
71 71
                 return $block->type === Block::TYPE_BLOCK;
72 72
             })
73 73
             ->values();
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function getBlockList()
80 80
     {
81
-        return $this->getBlocks()->map(function (Block $block) {
81
+        return $this->getBlocks()->map(function(Block $block) {
82 82
             return $block->toList();
83 83
         });
84 84
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             return collect();
106 106
         }
107 107
 
108
-        return collect($this->fileSystem->files($directory))->map(function (
108
+        return collect($this->fileSystem->files($directory))->map(function(
109 109
             $file
110 110
         ) use ($source, $type) {
111 111
             return new Block($file, $type, $source);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $this->paths = collect(
121 121
             config('twill.block_editor.directories.source.blocks')
122 122
         )
123
-            ->map(function ($path) {
123
+            ->map(function($path) {
124 124
                 $path['type'] = Block::TYPE_BLOCK;
125 125
 
126 126
                 return $path;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             ->merge(
129 129
                 collect(
130 130
                     config('twill.block_editor.directories.source.repeaters')
131
-                )->map(function ($path) {
131
+                )->map(function($path) {
132 132
                     $path['type'] = Block::TYPE_REPEATER;
133 133
 
134 134
                     return $path;
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
         $this->generatePaths();
167 167
 
168 168
         $this->items = collect($this->paths)
169
-            ->reduce(function (Collection $keep, $path) {
169
+            ->reduce(function(Collection $keep, $path) {
170 170
                 $this->readBlocks(
171 171
                     $path['path'],
172 172
                     $path['source'],
173 173
                     $path['type']
174
-                )->each(function ($block) use ($keep) {
174
+                )->each(function($block) use ($keep) {
175 175
                     $keep->push($block);
176 176
 
177 177
                     return $keep;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             ->toArray();
183 183
 
184 184
         $this->items = $this->collect()
185
-            ->each(function (Block $block) {
185
+            ->each(function(Block $block) {
186 186
                 $block->setSource($this->detectCustomSources($block));
187 187
             })
188 188
             ->toArray();
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function list()
205 205
     {
206
-        return $this->collect()->map(function (Block $block) {
206
+        return $this->collect()->map(function(Block $block) {
207 207
             return $block->toList();
208 208
         });
209 209
     }
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     public function getRepeaters()
223 223
     {
224 224
         return $this->collect()
225
-            ->filter(function ($block) {
225
+            ->filter(function($block) {
226 226
                 return $block->type === Block::TYPE_REPEATER;
227 227
             })
228 228
             ->values();
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      */
234 234
     public function getRepeaterList()
235 235
     {
236
-        return $this->getRepeaters()->map(function (Block $block) {
236
+        return $this->getRepeaters()->map(function(Block $block) {
237 237
             return $block->toList();
238 238
         });
239 239
     }
Please login to merge, or discard this patch.
src/Services/Blocks/BlockMaker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -309,7 +309,7 @@
 block discarded – undo
309 309
 
310 310
         return collect(
311 311
             $this->files->files(__DIR__ . '/../../../frontend/icons')
312
-        )->reduce(function ($keep, SplFileInfo $file) use ($icon) {
312
+        )->reduce(function($keep, SplFileInfo $file) use ($icon) {
313 313
             if ($keep) {
314 314
                 return $keep;
315 315
             }
Please login to merge, or discard this patch.
src/Commands/ListIcons.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
     {
66 66
         return collect(
67 67
             config('twill.block_editor.directories.source.icons')
68
-        )->reduce(function (Collection $keep, $path) {
68
+        )->reduce(function(Collection $keep, $path) {
69 69
             if (!$this->files->exists($path)) {
70 70
                 $this->displayError("Directory not found: {$path}");
71 71
 
72 72
                 return $keep;
73 73
             }
74 74
 
75
-            $files = collect($this->files->files($path))->map(function (
75
+            $files = collect($this->files->files($path))->map(function(
76 76
                 SplFileInfo $file
77 77
             ) {
78 78
                 return [
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function handle()
94 94
     {
95
-        $icons = $this->getIconList()->filter(function ($icon) {
95
+        $icons = $this->getIconList()->filter(function($icon) {
96 96
             return $this->isAllowed($icon);
97 97
         });
98 98
 
Please login to merge, or discard this patch.
src/Commands/ListBlocks.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $this->blockCollection
48 48
             ->getMissingDirectories()
49
-            ->each(function ($directory) {
49
+            ->each(function($directory) {
50 50
                 $this->error("Directory not found: {$directory}");
51 51
             });
52 52
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         return $blockCollection
61 61
             ->first()
62 62
             ->keys()
63
-            ->map(function ($key) {
63
+            ->map(function($key) {
64 64
                 return Str::studly($key);
65 65
             })
66 66
             ->toArray();
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 
81 81
         return $this->blockCollection
82 82
             ->collect()
83
-            ->reject(function (Block $block) use ($sourceFiltered) {
83
+            ->reject(function(Block $block) use ($sourceFiltered) {
84 84
                 return $sourceFiltered && !$this->option($block->source);
85 85
             })
86
-            ->reject(function (Block $block) use ($typeFiltered) {
86
+            ->reject(function(Block $block) use ($typeFiltered) {
87 87
                 return $this->dontPassTextFilter($block) ||
88 88
                     ($typeFiltered &&
89 89
                         !$this->option(Str::plural($block->type)));
90 90
             })
91
-            ->map(function (Block $block) {
91
+            ->map(function(Block $block) {
92 92
                 return $this->colorize($block->toList());
93 93
             })
94 94
             ->sortBy('title');
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         if (filled($filter = $this->argument('filter'))) {
148 148
             return !$block
149 149
                 ->toList()
150
-                ->reduce(function ($keep, $element) use ($filter) {
150
+                ->reduce(function($keep, $element) use ($filter) {
151 151
                     return $keep ||
152 152
                         Str::contains(
153 153
                             Str::lower($element),
Please login to merge, or discard this patch.
src/Helpers/helpers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 if (!function_exists('dumpUsableSqlQuery')) {
10 10
     function dumpUsableSqlQuery($query)
11 11
     {
12
-        dd(vsprintf(str_replace('?', '%s', $query->toSql()), array_map(function ($binding) {
12
+        dd(vsprintf(str_replace('?', '%s', $query->toSql()), array_map(function($binding) {
13 13
             return is_numeric($binding) ? $binding : "'{$binding}'";
14 14
         }, $query->getBindings())));
15 15
     }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      */
200 200
     function generate_list_of_available_blocks($blocks, $groups)
201 201
     {
202
-        return app(BlockCollection::class)->getBlockList()->filter(function ($block) use ($blocks, $groups) {
202
+        return app(BlockCollection::class)->getBlockList()->filter(function($block) use ($blocks, $groups) {
203 203
             return (filled($blocks) ? collect($blocks)->contains($block['name']) : true)
204 204
                     && (filled($groups) ? collect($groups)->contains($block['group']) : true);
205 205
         })->toArray();
Please login to merge, or discard this patch.