Passed
Push — dependabot/npm_and_yarn/docs/f... ( aa5127 )
by
unknown
09:29 queued 40s
created
src/Models/Media.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function __construct(array $attributes = [])
25 25
     {
26
-        $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function ($field) {
26
+        $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function($field) {
27 27
             return $field['name'];
28 28
         })->toArray()));
29 29
 
30
-        Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function ($field) {
30
+        Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function($field) {
31 31
             $this->casts[$field] = 'json';
32 32
         });
33 33
 
34 34
         parent::__construct($attributes);
35 35
     }
36 36
 
37
-    public function scopeUnused ($query)
37
+    public function scopeUnused($query)
38 38
     {
39 39
         $usedIds = DB::table(config('twill.mediables_table'))->get()->pluck('media_id');
40 40
         return $query->whereNotIn('id', $usedIds->toArray())->get();
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             'medium' => ImageService::getUrl($this->uuid, ["h" => "430"]),
76 76
             'width' => $this->width,
77 77
             'height' => $this->height,
78
-            'tags' => $this->tags->map(function ($tag) {
78
+            'tags' => $this->tags->map(function($tag) {
79 79
                 return $tag->name;
80 80
             }),
81 81
             'deleteUrl' => $this->canDeleteSafely() ? moduleRoute('medias', 'media-library', 'destroy', $this->id) : null,
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                     'caption' => $this->caption,
88 88
                     'altText' => $this->alt_text,
89 89
                     'video' => null,
90
-                ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function ($field) {
90
+                ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function($field) {
91 91
                     return [
92 92
                         $field['name'] => $this->{$field['name']},
93 93
                     ];
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
         if ($this->update($fields) && $this->isReferenced())
144 144
         {
145
-            DB::table(config('twill.mediables_table', 'twill_mediables'))->where('media_id', $this->id)->get()->each(function ($mediable) use ($prevWidth, $prevHeight) {
145
+            DB::table(config('twill.mediables_table', 'twill_mediables'))->where('media_id', $this->id)->get()->each(function($mediable) use ($prevWidth, $prevHeight) {
146 146
                 
147 147
                 if ($prevWidth != $this->width) {
148 148
                     $mediable->crop_x = 0;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     $mediable->crop_h = $this->height;
155 155
                 }
156 156
 
157
-                DB::table(config('twill.mediables_table', 'twill_mediables'))->where('id', $mediable->id)->update((array)$mediable);
157
+                DB::table(config('twill.mediables_table', 'twill_mediables'))->where('id', $mediable->id)->update((array) $mediable);
158 158
             });
159 159
         }
160 160
     }
Please login to merge, or discard this patch.
src/Helpers/helpers.php 1 patch
Spacing   +4 added lines, -4 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
     }
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
     {
202 202
         $blockList = app(BlockCollection::class)->getBlockList();
203 203
 
204
-        $appBlocksList = $blockList->filter(function ($block) {
204
+        $appBlocksList = $blockList->filter(function($block) {
205 205
             return $block['source'] !== A17\Twill\Services\Blocks\Block::SOURCE_TWILL;
206 206
         });
207 207
 
208 208
         $finalBlockList = $blockList->filter(
209
-            function ($block) use ($blocks, $groups, $appBlocksList) {
209
+            function($block) use ($blocks, $groups, $appBlocksList) {
210 210
                 if ($block['group'] === A17\Twill\Services\Blocks\Block::SOURCE_TWILL) {
211 211
                     if (!collect(
212 212
                         config('twill.block_editor.use_twill_blocks')
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                     }
216 216
 
217 217
                     if (count($appBlocksList) > 0 && $appBlocksList->contains(
218
-                        function ($appBlock) use ($block) {
218
+                        function($appBlock) use ($block) {
219 219
                             return $appBlock['name'] === $block['name'];
220 220
                         })
221 221
                     ) {
Please login to merge, or discard this patch.
src/Commands/ModuleMakeDeprecated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 
44 44
         $this->call('twill:make:module', [
45 45
             'moduleName' => $this->argument('moduleName'),
46
-        ] + $options->mapWithKeys(function ($value, $key) {
46
+        ] + $options->mapWithKeys(function($value, $key) {
47 47
             return ["--{$key}" => $value];
48 48
         })->toArray());
49 49
     }
Please login to merge, or discard this patch.
src/TwillServiceProvider.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
         }
135 135
 
136 136
         if (config('twill.enabled.media-library')) {
137
-            $this->app->singleton('imageService', function () {
137
+            $this->app->singleton('imageService', function() {
138 138
                 return $this->app->make(config('twill.media_library.image_service'));
139 139
             });
140 140
         }
141 141
 
142 142
         if (config('twill.enabled.file-library')) {
143
-            $this->app->singleton('fileService', function () {
143
+            $this->app->singleton('fileService', function() {
144 144
                 return $this->app->make(config('twill.file_library.file_service'));
145 145
             });
146 146
         }
@@ -346,20 +346,20 @@  discard block
 block discarded – undo
346 346
     {
347 347
         $blade = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler();
348 348
 
349
-        $blade->directive('dd', function ($param) {
349
+        $blade->directive('dd', function($param) {
350 350
             return "<?php dd({$param}); ?>";
351 351
         });
352 352
 
353
-        $blade->directive('dumpData', function ($data) {
353
+        $blade->directive('dumpData', function($data) {
354 354
             return sprintf("<?php (new Symfony\Component\VarDumper\VarDumper)->dump(%s); exit; ?>",
355 355
                 null != $data ? $data : "get_defined_vars()");
356 356
         });
357 357
 
358
-        $blade->directive('formField', function ($expression) {
358
+        $blade->directive('formField', function($expression) {
359 359
             return $this->includeView('partials.form._', $expression);
360 360
         });
361 361
 
362
-        $blade->directive('partialView', function ($expression) {
362
+        $blade->directive('partialView', function($expression) {
363 363
 
364 364
             $expressionAsArray = str_getcsv($expression, ',', '\'');
365 365
 
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
             ?>";
396 396
         });
397 397
 
398
-        $blade->directive('pushonce', function ($expression) {
398
+        $blade->directive('pushonce', function($expression) {
399 399
             [$pushName, $pushSub] = explode(':', trim(substr($expression, 1, -1)));
400 400
             $key = '__pushonce_' . $pushName . '_' . str_replace('-', '_', $pushSub);
401 401
             return "<?php if(! isset(\$__env->{$key})): \$__env->{$key} = 1; \$__env->startPush('{$pushName}'); ?>";
402 402
         });
403 403
 
404
-        $blade->directive('endpushonce', function () {
404
+        $blade->directive('endpushonce', function() {
405 405
             return '<?php $__env->stopPush(); endif; ?>';
406 406
         });
407 407
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 
443 443
         View::composer('twill::partials.navigation.*', ActiveNavigation::class);
444 444
 
445
-        View::composer(['admin.*', 'templates.*', 'twill::*'], function ($view) {
445
+        View::composer(['admin.*', 'templates.*', 'twill::*'], function($view) {
446 446
             $with = array_merge([
447 447
                 'renderForBlocks' => false,
448 448
                 'renderForModal' => false,
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleBlocks.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $blockRepository = app(BlockRepository::class);
75 75
 
76 76
         $blockRepository->bulkDelete($object->blocks()->pluck('id')->toArray());
77
-        $this->getBlocks($object, $fields)->each(function ($block) use ($object, $blockRepository) {
77
+        $this->getBlocks($object, $fields)->each(function($block) use ($object, $blockRepository) {
78 78
             $this->createBlock($blockRepository, $block);
79 79
         });
80 80
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $blockCreated = $blockRepository->create($blockFields);
93 93
 
94 94
         // Handle child blocks
95
-        $blockFields['blocks']->each(function ($childBlock) use ($blockCreated, $blockRepository) {
95
+        $blockFields['blocks']->each(function($childBlock) use ($blockCreated, $blockRepository) {
96 96
             $childBlock['parent_id'] = $blockCreated->id;
97 97
             $this->createBlock($blockRepository, $childBlock);
98 98
         });
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
                     ];
204 204
                 }
205 205
 
206
-                $fields['blocksFields'][] = Collection::make($block['content'])->filter(function ($value, $key) {
206
+                $fields['blocksFields'][] = Collection::make($block['content'])->filter(function($value, $key) {
207 207
                     return $key !== "browsers";
208
-                })->map(function ($value, $key) use ($block) {
208
+                })->map(function($value, $key) use ($block) {
209 209
                     return [
210 210
                         'name' => "blocks[$block->id][$key]",
211 211
                         'value' => $value,
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 
219 219
                 if ($medias) {
220 220
                     if (config('twill.media_library.translated_form_fields', false)) {
221
-                        $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function ($mediasByLocale, $locale) use ($block) {
222
-                            return Collection::make($mediasByLocale)->mapWithKeys(function ($value, $key) use ($block, $locale) {
221
+                        $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function($mediasByLocale, $locale) use ($block) {
222
+                            return Collection::make($mediasByLocale)->mapWithKeys(function($value, $key) use ($block, $locale) {
223 223
                                 return [
224 224
                                     "blocks[$block->id][$key][$locale]" => $value,
225 225
                                 ];
226 226
                             });
227 227
                         })->filter()->toArray();
228 228
                     } else {
229
-                        $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function ($value, $key) use ($block) {
229
+                        $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function($value, $key) use ($block) {
230 230
                             return [
231 231
                                 "blocks[$block->id][$key]" => $value,
232 232
                             ];
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
                 $files = $blockFormFields['files'];
238 238
 
239 239
                 if ($files) {
240
-                    Collection::make($files)->each(function ($rolesWithFiles, $locale) use (&$fields, $block) {
241
-                        $fields['blocksFiles'][] = Collection::make($rolesWithFiles)->mapWithKeys(function ($files, $role) use ($locale, $block) {
240
+                    Collection::make($files)->each(function($rolesWithFiles, $locale) use (&$fields, $block) {
241
+                        $fields['blocksFiles'][] = Collection::make($rolesWithFiles)->mapWithKeys(function($files, $role) use ($locale, $block) {
242 242
                             return [
243 243
                                 "blocks[$block->id][$role][$locale]" => $files,
244 244
                             ];
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     protected function getBlockBrowsers($block)
279 279
     {
280
-        return Collection::make($block['content']['browsers'])->mapWithKeys(function ($ids, $relation) use ($block) {
280
+        return Collection::make($block['content']['browsers'])->mapWithKeys(function($ids, $relation) use ($block) {
281 281
             if (Schema::hasTable(config('twill.related_table', 'twill_related')) && $block->getRelated($relation)->isNotEmpty()) {
282 282
                 $items = $this->getFormFieldsForRelatedBrowser($block, $relation);
283 283
                 foreach ($items as &$item) {
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
                     $sortedRelatedItems[$item->id] = $item;
295 295
                 }
296 296
 
297
-                $items = Collection::make(array_values($sortedRelatedItems))->filter(function ($value) {
297
+                $items = Collection::make(array_values($sortedRelatedItems))->filter(function($value) {
298 298
                     return is_object($value);
299
-                })->map(function ($relatedElement) use ($relation) {
299
+                })->map(function($relatedElement) use ($relation) {
300 300
                     return [
301 301
                         'id' => $relatedElement->id,
302 302
                         'name' => $relatedElement->titleInBrowser ?? $relatedElement->title,
Please login to merge, or discard this patch.
src/Commands/GenerateBlocks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             ->collect()
72 72
             ->where('compiled', true)
73 73
             ->whereIn('source', [Block::SOURCE_APP, Block::SOURCE_CUSTOM])
74
-            ->map(function ($block) {
74
+            ->map(function($block) {
75 75
                 $blockName = str_replace('a17-block-', '', $block->component);
76 76
                 $basename = str_replace('.blade.php', '', $block->fileName);
77 77
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     $this->filesystem->put($vueBlockPath, $vueBlockContent);
94 94
                     $this->info("Block " . Str::title($blockName) . " generated successfully");
95 95
                 } else {
96
-                    $this->info("Skipping block " .  Str::title($blockName) . ".");
96
+                    $this->info("Skipping block " . Str::title($blockName) . ".");
97 97
                 }
98 98
             });
99 99
 
Please login to merge, or discard this patch.
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/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.