Passed
Push — fix/818 ( 4e4f79...2f124a )
by Quentin
05:20
created
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/Helpers/i18n_helpers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
      */
17 17
     function getLocales()
18 18
     {
19
-        $locales = collect(config('translatable.locales'))->map(function ($locale, $index) {
20
-            return collect($locale)->map(function ($country) use ($locale, $index) {
19
+        $locales = collect(config('translatable.locales'))->map(function($locale, $index) {
20
+            return collect($locale)->map(function($country) use ($locale, $index) {
21 21
                 return is_numeric($index)
22 22
                     ? $locale
23 23
                     : "$index-$country";
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $manageMultipleLanguages = count(getLocales()) > 1;
44 44
         if ($manageMultipleLanguages && $translate) {
45
-            $allLanguages = Collection::make(getLocales())->map(function ($locale, $index) use ($form_fields) {
45
+            $allLanguages = Collection::make(getLocales())->map(function($locale, $index) use ($form_fields) {
46 46
                 return [
47 47
                     'shortlabel' => strtoupper($locale),
48 48
                     'label' => getLanguageLabelFromLocaleCode($locale),
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/Models/Behaviors/HasMedias.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     private function findMedia($role, $crop = "default")
44 44
     {
45
-        $media = $this->medias->first(function ($media) use ($role, $crop) {
45
+        $media = $this->medias->first(function($media) use ($role, $crop) {
46 46
             if (config('twill.media_library.translated_form_fields', false)) {
47 47
                 $localeScope = $media->pivot->locale === app()->getLocale();
48 48
             }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         });
52 52
 
53 53
         if (!$media && config('twill.media_library.translated_form_fields', false)) {
54
-            $media = $this->medias->first(function ($media) use ($role, $crop) {
54
+            $media = $this->medias->first(function($media) use ($role, $crop) {
55 55
                 return $media->pivot->role === $role && $media->pivot->crop === $crop;
56 56
             });
57 57
         }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function images($role, $crop = "default", $params = [])
122 122
     {
123
-        $medias = $this->medias->filter(function ($media) use ($role, $crop) {
123
+        $medias = $this->medias->filter(function($media) use ($role, $crop) {
124 124
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
125 125
         });
126 126
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function imagesWithCrops($role, $params = [])
144 144
     {
145
-        $medias = $this->medias->filter(function ($media) use ($role) {
145
+        $medias = $this->medias->filter(function($media) use ($role) {
146 146
             return $media->pivot->role === $role;
147 147
         });
148 148
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function imagesAsArrays($role, $crop = "default", $params = [])
197 197
     {
198
-        $medias = $this->medias->filter(function ($media) use ($role, $crop) {
198
+        $medias = $this->medias->filter(function($media) use ($role, $crop) {
199 199
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
200 200
         });
201 201
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      */
218 218
     public function imagesAsArraysWithCrops($role, $params = [])
219 219
     {
220
-        $medias = $this->medias->filter(function ($media) use ($role) {
220
+        $medias = $this->medias->filter(function($media) use ($role) {
221 221
             return $media->pivot->role === $role;
222 222
         });
223 223
 
@@ -241,12 +241,12 @@  discard block
 block discarded – undo
241 241
     public function imageAltText($role, $media = null)
242 242
     {
243 243
         if (!$media) {
244
-            $media = $this->medias->first(function ($media) use ($role) {
244
+            $media = $this->medias->first(function($media) use ($role) {
245 245
                 if (config('twill.media_library.translated_form_fields', false)) {
246 246
                     $localeScope = $media->pivot->locale === app()->getLocale();
247 247
                 }
248 248
 
249
-                return $media->pivot->role === $role && ($localeScope ?? true);;
249
+                return $media->pivot->role === $role && ($localeScope ?? true); ;
250 250
             });
251 251
         }
252 252
 
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
     public function imageCaption($role, $media = null)
268 268
     {
269 269
         if (!$media) {
270
-            $media = $this->medias->first(function ($media) use ($role) {
270
+            $media = $this->medias->first(function($media) use ($role) {
271 271
                 if (config('twill.media_library.translated_form_fields', false)) {
272 272
                     $localeScope = $media->pivot->locale === app()->getLocale();
273 273
                 }
274 274
 
275
-                return $media->pivot->role === $role && ($localeScope ?? true);;
275
+                return $media->pivot->role === $role && ($localeScope ?? true); ;
276 276
             });
277 277
         }
278 278
 
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
     public function imageVideo($role, $media = null)
294 294
     {
295 295
         if (!$media) {
296
-            $media = $this->medias->first(function ($media) use ($role) {
296
+            $media = $this->medias->first(function($media) use ($role) {
297 297
                 if (config('twill.media_library.translated_form_fields', false)) {
298 298
                     $localeScope = $media->pivot->locale === app()->getLocale();
299 299
                 }
300 300
 
301
-                return $media->pivot->role === $role && ($localeScope ?? true);;
301
+                return $media->pivot->role === $role && ($localeScope ?? true); ;
302 302
             });
303 303
         }
304 304
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      */
416 416
     public function imageObjects($role, $crop = "default")
417 417
     {
418
-        return $this->medias->filter(function ($media) use ($role, $crop) {
418
+        return $this->medias->filter(function($media) use ($role, $crop) {
419 419
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
420 420
         });
421 421
     }
Please login to merge, or discard this patch.
src/Models/Behaviors/HasRevisions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function scopeMine($query)
24 24
     {
25
-        return $query->whereHas('revisions', function ($query) {
25
+        return $query->whereHas('revisions', function($query) {
26 26
             $query->where('user_id', auth('twill_users')->user()->id);
27 27
         });
28 28
     }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function revisionsArray()
36 36
     {
37
-        return $this->revisions->map(function ($revision) {
37
+        return $this->revisions->map(function($revision) {
38 38
             return [
39 39
                 'id' => $revision->id,
40 40
                 'author' => $revision->user->name ?? 'Unknown',
Please login to merge, or discard this patch.
src/Models/Behaviors/HasSlug.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 
12 12
     protected static function bootHasSlug()
13 13
     {
14
-        static::created(function ($model) {
14
+        static::created(function($model) {
15 15
             $model->setSlugs();
16 16
         });
17 17
 
18
-        static::updated(function ($model) {
18
+        static::updated(function($model) {
19 19
             $model->setSlugs();
20 20
         });
21 21
 
22
-        static::restored(function ($model) {
22
+        static::restored(function($model) {
23 23
             $model->setSlugs($restoring = true);
24 24
         });
25 25
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function scopeForSlug($query, $slug)
74 74
     {
75
-        return $query->whereHas('slugs', function ($query) use ($slug) {
75
+        return $query->whereHas('slugs', function($query) use ($slug) {
76 76
             $query->whereSlug($slug);
77 77
             $query->whereActive(true);
78 78
             $query->whereLocale(app()->getLocale());
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function scopeForInactiveSlug($query, $slug)
88 88
     {
89
-        return $query->whereHas('slugs', function ($query) use ($slug) {
89
+        return $query->whereHas('slugs', function($query) use ($slug) {
90 90
             $query->whereSlug($slug);
91 91
             $query->whereLocale(app()->getLocale());
92 92
         })->with(['slugs']);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function scopeForFallbackLocaleSlug($query, $slug)
101 101
     {
102
-        return $query->whereHas('slugs', function ($query) use ($slug) {
102
+        return $query->whereHas('slugs', function($query) use ($slug) {
103 103
             $query->whereSlug($slug);
104 104
             $query->whereActive(true);
105 105
             $query->whereLocale(config('translatable.fallback_locale'));
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         foreach ($slugParams as $key => $value) {
156 156
             //check variations of the slug
157 157
             if ($key == 'slug') {
158
-                $query->where(function ($query) use ($value) {
158
+                $query->where(function($query) use ($value) {
159 159
                     $query->orWhere('slug', $value);
160 160
                     $query->orWhere('slug', $value . '-' . $this->getSuffixSlug());
161 161
                     for ($i = 2; $i <= $this->nb_variation_slug; $i++) {
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function getActiveSlug($locale = null)
237 237
     {
238
-        return $this->slugs->first(function ($slug) use ($locale) {
238
+        return $this->slugs->first(function($slug) use ($locale) {
239 239
             return ($slug->locale === ($locale ?? app()->getLocale())) && $slug->active;
240 240
         }) ?? null;
241 241
     }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     public function getFallbackActiveSlug()
249 249
     {
250
-        return $this->slugs->first(function ($slug) {
250
+        return $this->slugs->first(function($slug) {
251 251
             return $slug->locale === config('translatable.fallback_locale') && $slug->active;
252 252
         }) ?? null;
253 253
     }
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.
src/Repositories/Behaviors/HandleTags.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         if (!empty($ids)) {
58 58
             foreach ($ids as $id) {
59
-                $tagQuery->whereHas('tagged', function ($query) use ($id) {
59
+                $tagQuery->whereHas('tagged', function($query) use ($id) {
60 60
                     $query->where('taggable_id', $id);
61 61
                 });
62 62
             }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getTagsList()
72 72
     {
73
-        return $this->getTagsQuery()->where('count', '>', 0)->select('name', 'id')->get()->map(function ($tag) {
73
+        return $this->getTagsQuery()->where('count', '>', 0)->select('name', 'id')->get()->map(function($tag) {
74 74
             return [
75 75
                 'label' => $tag->name,
76 76
                 'value' => $tag->id,
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleRelatedBrowsers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
      */
67 67
     protected function getRelatedBrowsers()
68 68
     {
69
-        return collect($this->relatedBrowsers)->map(function ($browser, $key) {
69
+        return collect($this->relatedBrowsers)->map(function($browser, $key) {
70 70
             $browserName = is_string($browser) ? $browser : $key;
71 71
             $moduleName = !empty($browser['moduleName']) ? $browser['moduleName'] : $this->inferModuleNameFromBrowserName($browserName);
72 72
 
Please login to merge, or discard this patch.