Passed
Push — fix/initial-build ( 69cc72...8bd180 )
by Quentin
07:44
created
src/Http/Controllers/Admin/ModuleController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
             "$this->viewPrefix.index",
332 332
             "twill::$this->moduleName.index",
333 333
             "twill::layouts.listing",
334
-        ])->first(function ($view) {
334
+        ])->first(function($view) {
335 335
             return View::exists($view);
336 336
         });
337 337
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
             "$this->viewPrefix.form",
443 443
             "twill::$this->moduleName.form",
444 444
             "twill::layouts.form",
445
-        ])->first(function ($view) {
445
+        ])->first(function($view) {
446 446
             return View::exists($view);
447 447
         });
448 448
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             "$this->viewPrefix.form",
470 470
             "twill::$this->moduleName.form",
471 471
             "twill::layouts.form",
472
-        ])->first(function ($view) {
472
+        ])->first(function($view) {
473 473
             return View::exists($view);
474 474
         });
475 475
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
             "$this->viewPrefix.form",
593 593
             "twill::$this->moduleName.form",
594 594
             "twill::layouts.form",
595
-        ])->first(function ($view) {
595
+        ])->first(function($view) {
596 596
             return View::exists($view);
597 597
         });
598 598
 
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
         $query = $this->request->input('q');
840 840
         $tags = $this->repository->getTags($query);
841 841
 
842
-        return Response::json(['items' => $tags->map(function ($tag) {
842
+        return Response::json(['items' => $tags->map(function($tag) {
843 843
             return $tag->name;
844 844
         })], 200);
845 845
     }
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
     protected function getIndexTableData($items)
928 928
     {
929 929
         $translated = $this->moduleHas('translations');
930
-        return $items->map(function ($item) use ($translated) {
931
-            $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function ($column) use ($item) {
930
+        return $items->map(function($item) use ($translated) {
931
+            $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function($column) use ($item) {
932 932
                 return $this->getItemColumnData($item, $column);
933 933
             })->toArray();
934 934
 
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
             'feature',
1189 1189
             'bulkFeature',
1190 1190
             'bulkDelete',
1191
-        ])->mapWithKeys(function ($endpoint) {
1191
+        ])->mapWithKeys(function($endpoint) {
1192 1192
             return [
1193 1193
                 $endpoint . 'Url' => $this->getIndexOption($endpoint) ? moduleRoute(
1194 1194
                     $this->moduleName, $this->routePrefix, $endpoint,
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
      */
1205 1205
     protected function getIndexOption($option)
1206 1206
     {
1207
-        return once(function () use ($option) {
1207
+        return once(function() use ($option) {
1208 1208
             $customOptionNamesMapping = [
1209 1209
                 'store' => 'create',
1210 1210
             ];
@@ -1261,8 +1261,8 @@  discard block
 block discarded – undo
1261 1261
     {
1262 1262
         $withImage = $this->moduleHas('medias');
1263 1263
 
1264
-        return $items->map(function ($item) use ($withImage) {
1265
-            $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function ($column) use ($item) {
1264
+        return $items->map(function($item) use ($withImage) {
1265
+            $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function($column) use ($item) {
1266 1266
                 return $this->getItemColumnData($item, $column);
1267 1267
             })->toArray();
1268 1268
 
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
                     $fieldSplitted = explode('|', $field);
1329 1329
                     if (count($fieldSplitted) > 1) {
1330 1330
                         $requestValue = $requestFilters[$key];
1331
-                        Collection::make($fieldSplitted)->each(function ($scopeKey) use (&$scope, $requestValue) {
1331
+                        Collection::make($fieldSplitted)->each(function($scopeKey) use (&$scope, $requestValue) {
1332 1332
                             $scope[$scopeKey] = $requestValue;
1333 1333
                         });
1334 1334
                     } else {
@@ -1505,11 +1505,11 @@  discard block
 block discarded – undo
1505 1505
      */
1506 1506
     protected function validateFormRequest()
1507 1507
     {
1508
-        $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function ($permission, $field) {
1508
+        $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function($permission, $field) {
1509 1509
             return Auth::guard('twill_users')->user()->cannot($permission);
1510 1510
         })->keys();
1511 1511
 
1512
-        $unauthorizedFields->each(function ($field) {
1512
+        $unauthorizedFields->each(function($field) {
1513 1513
             $this->request->offsetUnset($field);
1514 1514
         });
1515 1515
 
@@ -1755,7 +1755,7 @@  discard block
 block discarded – undo
1755 1755
      */
1756 1756
     public function getRepeaterList()
1757 1757
     {
1758
-        return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function ($repeater) {
1758
+        return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function($repeater) {
1759 1759
             return [$repeater['name'] => $repeater];
1760 1760
         });
1761 1761
     }
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleRepeaters.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $relationRepository = $this->getModelRepository($relation, $model);
64 64
 
65 65
         if (!$keepExisting) {
66
-            $object->$relation()->each(function ($repeaterElement) {
66
+            $object->$relation()->each(function($repeaterElement) {
67 67
                 $repeaterElement->forceDelete();
68 68
             });
69 69
         }
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 
237 237
             if (isset($relatedItemFormFields['medias'])) {
238 238
                 if (config('twill.media_library.translated_form_fields', false)) {
239
-                    Collection::make($relatedItemFormFields['medias'])->each(function ($rolesWithMedias, $locale) use (&$repeatersMedias, $relation, $relationItem) {
240
-                        $repeatersMedias[] = Collection::make($rolesWithMedias)->mapWithKeys(function ($medias, $role) use ($locale, $relation, $relationItem) {
239
+                    Collection::make($relatedItemFormFields['medias'])->each(function($rolesWithMedias, $locale) use (&$repeatersMedias, $relation, $relationItem) {
240
+                        $repeatersMedias[] = Collection::make($rolesWithMedias)->mapWithKeys(function($medias, $role) use ($locale, $relation, $relationItem) {
241 241
                             return [
242 242
                                 "blocks[$relation-$relationItem->id][$role][$locale]" => $medias,
243 243
                             ];
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
             }
252 252
 
253 253
             if (isset($relatedItemFormFields['files'])) {
254
-                Collection::make($relatedItemFormFields['files'])->each(function ($rolesWithFiles, $locale) use (&$repeatersFiles, $relation, $relationItem) {
255
-                    $repeatersFiles[] = Collection::make($rolesWithFiles)->mapWithKeys(function ($files, $role) use ($locale, $relation, $relationItem) {
254
+                Collection::make($relatedItemFormFields['files'])->each(function($rolesWithFiles, $locale) use (&$repeatersFiles, $relation, $relationItem) {
255
+                    $repeatersFiles[] = Collection::make($rolesWithFiles)->mapWithKeys(function($files, $role) use ($locale, $relation, $relationItem) {
256 256
                         return [
257 257
                             "blocks[$relation-$relationItem->id][$role][$locale]" => $files,
258 258
                         ];
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      */
303 303
     protected function getRepeaters()
304 304
     {
305
-        return collect($this->repeaters)->map(function ($repeater, $key) {
305
+        return collect($this->repeaters)->map(function($repeater, $key) {
306 306
             $repeaterName = is_string($repeater) ? $repeater : $key;
307 307
             return [
308 308
                 'relation' => !empty($repeater['relation']) ? $repeater['relation'] : $this->inferRelationFromRepeaterName($repeaterName),
Please login to merge, or discard this patch.
src/Repositories/SettingRepository.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function byKey($key, $section = null)
36 36
     {
37
-        return $this->model->when($section, function ($query) use ($section) {
37
+        return $this->model->when($section, function($query) use ($section) {
38 38
             $query->where('section', $section);
39 39
         })->where('key', $key)->exists() ? $this->model->where('key', $key)->with('translations')->first()->value : null;
40 40
     }
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function getFormFields($section = null)
47 47
     {
48
-        $settings = $this->model->when($section, function ($query) use ($section) {
48
+        $settings = $this->model->when($section, function($query) use ($section) {
49 49
             $query->where('section', $section);
50 50
         })->with('translations', 'medias')->get();
51 51
 
52 52
 
53 53
         if (config('twill.media_library.translated_form_fields', false)) {
54
-            $medias = $settings->reduce(function ($carry, $setting) {
54
+            $medias = $settings->reduce(function($carry, $setting) {
55 55
                 foreach (getLocales() as $locale) {
56 56
                     if (!empty(parent::getFormFields($setting)['medias'][$locale]) && !empty(parent::getFormFields($setting)['medias'][$locale][$setting->key]))
57 57
                     {
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
                 return $carry;
62 62
             });
63 63
         } else {
64
-            $medias = $settings->mapWithKeys(function ($setting) {
64
+            $medias = $settings->mapWithKeys(function($setting) {
65 65
                 return [$setting->key => parent::getFormFields($setting)['medias'][$setting->key] ?? null];
66 66
             })->filter()->toArray();
67 67
         }
68 68
 
69
-        return $settings->mapWithKeys(function ($setting) {
69
+        return $settings->mapWithKeys(function($setting) {
70 70
             $settingValue = [];
71 71
 
72 72
             foreach ($setting->translations as $translation) {
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 
118 118
             if (config('twill.media_library.translated_form_fields', false)) {
119 119
                 foreach (getLocales() as $locale) {
120
-                    $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function ($media) {
120
+                    $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function($media) {
121 121
                         return json_decode($media, true);
122 122
                     })->filter()->toArray();
123 123
                 }
124 124
             } else {
125
-                $medias =  [
126
-                    $role => Collection::make($settingsFields['medias'][$role])->map(function ($media) {
125
+                $medias = [
126
+                    $role => Collection::make($settingsFields['medias'][$role])->map(function($media) {
127 127
                         return json_decode($media, true);
128 128
                     })->values()->filter()->toArray(),
129 129
                 ];
Please login to merge, or discard this patch.
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/Services/Blocks/Block.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -240,8 +240,8 @@
 block discarded – undo
240 240
 
241 241
         // Title is mandatory
242 242
         throw new Exception(
243
-            "Block {$blockName} does not exists or the mandatory property '{$property}' ".
244
-            "was not found on this block. If you are still using blocks on the twill.php ".
243
+            "Block {$blockName} does not exists or the mandatory property '{$property}' " .
244
+            "was not found on this block. If you are still using blocks on the twill.php " .
245 245
             "file, please check if the block is present and properly configured."
246 246
         );
247 247
     }
Please login to merge, or discard this patch.