Passed
Push — laravel-9-support ( 40abed...9d59e4 )
by Harings
18:14 queued 10:22
created
src/CapsulesServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function registerCapsules()
46 46
     {
47
-        $this->manager->getCapsuleList()->map(function ($capsule) {
47
+        $this->manager->getCapsuleList()->map(function($capsule) {
48 48
             $this->registerCapsule($capsule);
49 49
         });
50 50
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         if (!self::$capsulesBootstrapped) {
60 60
             $this->getCapsuleList()
61 61
                 ->where('enabled', true)
62
-                ->each(function ($capsule) {
62
+                ->each(function($capsule) {
63 63
                     $this->bootstrapCapsule($capsule);
64 64
                 });
65 65
             self::$capsulesBootstrapped = true;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     public function registerViewPaths()
76 76
     {
77 77
         if (file_exists(config('twill.capsules.path'))) {
78
-            $callback = function ($view) {
78
+            $callback = function($view) {
79 79
                 $view->addLocation(config('twill.capsules.path'));
80 80
             };
81 81
 
Please login to merge, or discard this patch.
src/Services/Capsules/HasCapsules.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         if (!config('twill.capsules.loaded')) {
24 24
             $list = $list
25 25
                 ->where('enabled', true)
26
-                ->map(function ($capsule) use ($path) {
26
+                ->map(function($capsule) use ($path) {
27 27
                     return $this->makeCapsule($capsule, $path);
28 28
                 });
29 29
         }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function getCapsuleByModule($module)
42 42
     {
43 43
         return $this->getCapsuleList()
44
-            ->filter(function ($capsule) use ($module) {
44
+            ->filter(function($capsule) use ($module) {
45 45
                 return Str::lower($capsule['plural']) == Str::lower($module);
46 46
             })
47 47
             ->first();
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     {
265 265
         $twillSeeder = app(CapsuleSeeder::class);
266 266
 
267
-        $this->getCapsuleList()->each(function ($capsule) use (
267
+        $this->getCapsuleList()->each(function($capsule) use (
268 268
             $twillSeeder,
269 269
             $illuminateSeeder
270 270
         ) {
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
             return;
376 376
         }
377 377
 
378
-        collect($files)->each(function ($file) {
378
+        collect($files)->each(function($file) {
379 379
             if (file_exists($file)) {
380 380
                 require_once $file;
381 381
             }
Please login to merge, or discard this patch.
src/Commands/RefreshCrops.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
         $this->modelName = $this->locateModel($this->argument('modelName'));
100 100
 
101
-        if (! $this->modelName) {
101
+        if (!$this->modelName) {
102 102
             $this->error("Model `{$this->argument('modelName')}` was not found`");
103 103
 
104 104
             return 1;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
         $mediasParams = app($this->modelName)->mediasParams;
110 110
 
111
-        if (! isset($mediasParams[$this->roleName])) {
111
+        if (!isset($mediasParams[$this->roleName])) {
112 112
             $this->error("Role `{$this->roleName}` was not found`");
113 113
 
114 114
             return 1;
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
-        $settingQuery = $this->model->when($section, function ($query) use ($section) {
37
+        $settingQuery = $this->model->when($section, function($query) use ($section) {
38 38
             $query->where('section', $section);
39 39
         })->where('key', $key);
40 40
 
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function getFormFields($section = null)
53 53
     {
54
-        $settings = $this->model->when($section, function ($query) use ($section) {
54
+        $settings = $this->model->when($section, function($query) use ($section) {
55 55
             $query->where('section', $section);
56 56
         })->with('translations', 'medias')->get();
57 57
 
58 58
 
59 59
         if (config('twill.media_library.translated_form_fields', false)) {
60
-            $medias = $settings->reduce(function ($carry, $setting) {
60
+            $medias = $settings->reduce(function($carry, $setting) {
61 61
                 foreach (getLocales() as $locale) {
62 62
                     if (!empty(parent::getFormFields($setting)['medias'][$locale]) && !empty(parent::getFormFields($setting)['medias'][$locale][$setting->key]))
63 63
                     {
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
                 return $carry;
68 68
             });
69 69
         } else {
70
-            $medias = $settings->mapWithKeys(function ($setting) {
70
+            $medias = $settings->mapWithKeys(function($setting) {
71 71
                 return [$setting->key => parent::getFormFields($setting)['medias'][$setting->key] ?? null];
72 72
             })->filter()->toArray();
73 73
         }
74 74
 
75
-        return $settings->mapWithKeys(function ($setting) {
75
+        return $settings->mapWithKeys(function($setting) {
76 76
             $settingValue = [];
77 77
 
78 78
             foreach ($setting->translations as $translation) {
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 
124 124
             if (config('twill.media_library.translated_form_fields', false)) {
125 125
                 foreach (getLocales() as $locale) {
126
-                    $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function ($media) {
126
+                    $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function($media) {
127 127
                         return json_decode($media, true);
128 128
                     })->filter()->toArray();
129 129
                 }
130 130
             } else {
131
-                $medias =  [
132
-                    $role => Collection::make($settingsFields['medias'][$role])->map(function ($media) {
131
+                $medias = [
132
+                    $role => Collection::make($settingsFields['medias'][$role])->map(function($media) {
133 133
                         return json_decode($media, true);
134 134
                     })->values()->filter()->toArray(),
135 135
                 ];
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleTranslations.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 
33 33
             $submittedLanguages = Collection::make($fields['languages'] ?? []);
34 34
 
35
-            $atLeastOneLanguageIsPublished = $submittedLanguages->contains(function ($language) {
35
+            $atLeastOneLanguageIsPublished = $submittedLanguages->contains(function($language) {
36 36
                 return $language['published'];
37 37
             });
38 38
 
39 39
             foreach ($locales as $index => $locale) {
40
-                $submittedLanguage = Arr::first($submittedLanguages->filter(function ($lang) use ($locale) {
40
+                $submittedLanguage = Arr::first($submittedLanguages->filter(function($lang) use ($locale) {
41 41
                     return $lang['value'] == $locale;
42 42
                 }));
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
                 $fields[$locale] = [
49 49
                     'active' => $activeField,
50
-                ] + $attributes->mapWithKeys(function ($attribute) use (&$fields, $locale, $localesCount, $index) {
50
+                ] + $attributes->mapWithKeys(function($attribute) use (&$fields, $locale, $localesCount, $index) {
51 51
                     $attributeValue = $fields[$attribute] ?? null;
52 52
 
53 53
                     // if we are at the last locale,
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         if ($this->model->isTranslatable()) {
108 108
             $attributes = $this->model->translatedAttributes;
109
-            $query->whereHas('translations', function ($q) use ($scopes, $attributes) {
109
+            $query->whereHas('translations', function($q) use ($scopes, $attributes) {
110 110
                 foreach ($attributes as $attribute) {
111 111
                     if (isset($scopes[$attribute]) && is_string($scopes[$attribute])) {
112 112
                         $q->where($attribute, $this->getLikeOperator(), '%' . $scopes[$attribute] . '%');
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
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     private function findMedia($role, $crop = "default")
45 45
     {
46 46
         $foundMedia = false;
47
-        $media = $this->medias->first(function ($media) use ($role, $crop, &$foundMedia) {
47
+        $media = $this->medias->first(function($media) use ($role, $crop, &$foundMedia) {
48 48
             if (config('twill.media_library.translated_form_fields', false)) {
49 49
                 $localeScope = $media->pivot->locale === app()->getLocale();
50 50
             }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         });
58 58
 
59 59
         if (!$media && config('twill.media_library.translated_form_fields', false)) {
60
-            $media = $this->medias->first(function ($media) use ($role, $crop, &$foundMedia) {
60
+            $media = $this->medias->first(function($media) use ($role, $crop, &$foundMedia) {
61 61
                 if (!$foundMedia) {
62 62
                     $foundMedia = $media->pivot->role === $role;
63 63
                 }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function images($role, $crop = "default", $params = [])
137 137
     {
138
-        $medias = $this->medias->filter(function ($media) use ($role, $crop) {
138
+        $medias = $this->medias->filter(function($media) use ($role, $crop) {
139 139
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
140 140
         });
141 141
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function imagesWithCrops($role, $params = [])
159 159
     {
160
-        $medias = $this->medias->filter(function ($media) use ($role) {
160
+        $medias = $this->medias->filter(function($media) use ($role) {
161 161
             return $media->pivot->role === $role;
162 162
         });
163 163
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     public function imagesAsArrays($role, $crop = "default", $params = [])
212 212
     {
213
-        $medias = $this->medias->filter(function ($media) use ($role, $crop) {
213
+        $medias = $this->medias->filter(function($media) use ($role, $crop) {
214 214
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
215 215
         });
216 216
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function imagesAsArraysWithCrops($role, $params = [])
234 234
     {
235
-        $medias = $this->medias->filter(function ($media) use ($role) {
235
+        $medias = $this->medias->filter(function($media) use ($role) {
236 236
             return $media->pivot->role === $role;
237 237
         });
238 238
 
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
     public function imageAltText($role, $media = null)
257 257
     {
258 258
         if (!$media) {
259
-            $media = $this->medias->first(function ($media) use ($role) {
259
+            $media = $this->medias->first(function($media) use ($role) {
260 260
                 if (config('twill.media_library.translated_form_fields', false)) {
261 261
                     $localeScope = $media->pivot->locale === app()->getLocale();
262 262
                 }
263 263
 
264
-                return $media->pivot->role === $role && ($localeScope ?? true);;
264
+                return $media->pivot->role === $role && ($localeScope ?? true); ;
265 265
             });
266 266
         }
267 267
 
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
     public function imageCaption($role, $media = null)
283 283
     {
284 284
         if (!$media) {
285
-            $media = $this->medias->first(function ($media) use ($role) {
285
+            $media = $this->medias->first(function($media) use ($role) {
286 286
                 if (config('twill.media_library.translated_form_fields', false)) {
287 287
                     $localeScope = $media->pivot->locale === app()->getLocale();
288 288
                 }
289 289
 
290
-                return $media->pivot->role === $role && ($localeScope ?? true);;
290
+                return $media->pivot->role === $role && ($localeScope ?? true); ;
291 291
             });
292 292
         }
293 293
 
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
     public function imageVideo($role, $media = null)
309 309
     {
310 310
         if (!$media) {
311
-            $media = $this->medias->first(function ($media) use ($role) {
311
+            $media = $this->medias->first(function($media) use ($role) {
312 312
                 if (config('twill.media_library.translated_form_fields', false)) {
313 313
                     $localeScope = $media->pivot->locale === app()->getLocale();
314 314
                 }
315 315
 
316
-                return $media->pivot->role === $role && ($localeScope ?? true);;
316
+                return $media->pivot->role === $role && ($localeScope ?? true); ;
317 317
             });
318 318
         }
319 319
 
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
      */
431 431
     public function imageObjects($role, $crop = "default")
432 432
     {
433
-        return $this->medias->filter(function ($media) use ($role, $crop) {
433
+        return $this->medias->filter(function($media) use ($role, $crop) {
434 434
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
435 435
         });
436 436
     }
Please login to merge, or discard this patch.