Passed
Push — master ( 136870...398928 )
by Quentin
53:06 queued 43:01
created
src/RouteServiceProvider.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
     private function mapHostRoutes($router, $groupOptions, $middlewares, $supportSubdomainRouting)
71 71
     {
72 72
         if (file_exists(base_path('routes/admin.php'))) {
73
-            $hostRoutes = function ($router) use ($middlewares) {
73
+            $hostRoutes = function($router) use ($middlewares) {
74 74
                 $router->group([
75 75
                     'namespace' => config('twill.namespace', 'App') . '\Http\Controllers\Admin',
76 76
                     'middleware' => $middlewares,
77
-                ], function ($router) {
77
+                ], function($router) {
78 78
                     require base_path('routes/admin.php');
79 79
                 });
80 80
             };
@@ -93,25 +93,25 @@  discard block
 block discarded – undo
93 93
 
94 94
     private function mapInternalRoutes($router, $groupOptions, $middlewares, $supportSubdomainRouting)
95 95
     {
96
-        $internalRoutes = function ($router) use ($middlewares, $supportSubdomainRouting) {
97
-            $router->group(['middleware' => $middlewares], function ($router) {
96
+        $internalRoutes = function($router) use ($middlewares, $supportSubdomainRouting) {
97
+            $router->group(['middleware' => $middlewares], function($router) {
98 98
                 require __DIR__ . '/../routes/admin.php';
99 99
             });
100 100
 
101 101
             $router->group([
102 102
                 'middleware' => $supportSubdomainRouting ? ['supportSubdomainRouting'] : [],
103
-            ], function ($router) {
103
+            ], function($router) {
104 104
                 require __DIR__ . '/../routes/auth.php';
105 105
             });
106 106
 
107
-            $router->group(['middleware' => $this->app->environment('production') ? ['twill_auth:twill_users'] : []], function ($router) {
107
+            $router->group(['middleware' => $this->app->environment('production') ? ['twill_auth:twill_users'] : []], function($router) {
108 108
                 require __DIR__ . '/../routes/templates.php';
109 109
             });
110 110
         };
111 111
 
112 112
         $router->group($groupOptions + [
113 113
             'namespace' => $this->namespace . '\Admin',
114
-        ], function ($router) use ($internalRoutes, $supportSubdomainRouting) {
114
+        ], function($router) use ($internalRoutes, $supportSubdomainRouting) {
115 115
             $router->group([
116 116
                 'domain' => config('twill.admin_app_url'),
117 117
             ], $internalRoutes);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
                 'domain' => config('app.url'),
130 130
                 'middleware' => [config('twill.admin_middleware_group', 'web')],
131 131
             ],
132
-                function ($router) {
133
-                    $router->group(['middleware' => $this->app->environment('production') ? ['twill_auth:twill_users'] : []], function ($router) {
132
+                function($router) {
133
+                    $router->group(['middleware' => $this->app->environment('production') ? ['twill_auth:twill_users'] : []], function($router) {
134 134
                         require __DIR__ . '/../routes/templates.php';
135 135
                     });
136 136
                 }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     protected function registerMacros()
167 167
     {
168
-        Route::macro('moduleShowWithPreview', function ($moduleName, $routePrefix = null, $controllerName = null) {
168
+        Route::macro('moduleShowWithPreview', function($moduleName, $routePrefix = null, $controllerName = null) {
169 169
             if ($routePrefix === null) {
170 170
                 $routePrefix = $moduleName;
171 171
             }
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
             Route::name($moduleName . '.preview')->get('/admin-preview' . $routePrefix . '{slug}', $controllerName . 'Controller@show')->middleware(['web', 'twill_auth:twill_users', 'can:list']);
182 182
         });
183 183
 
184
-        Route::macro('module', function ($slug, $options = [], $resource_options = [], $resource = true) {
184
+        Route::macro('module', function($slug, $options = [], $resource_options = [], $resource = true) {
185 185
 
186 186
             $slugs = explode('.', $slug);
187 187
             $prefixSlug = str_replace('.', "/", $slug);
188 188
             $_slug = Arr::last($slugs);
189
-            $className = implode("", array_map(function ($s) {
189
+            $className = implode("", array_map(function($s) {
190 190
                 return ucfirst(Str::singular($s));
191 191
             }, $slugs));
192 192
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             }
258 258
 
259 259
             if ($resource) {
260
-                Route::group(['as' => $resourceCustomGroupPrefix], function () use ($slug, $className, $resource_options) {
260
+                Route::group(['as' => $resourceCustomGroupPrefix], function() use ($slug, $className, $resource_options) {
261 261
                     Route::resource($slug, "{$className}Controller", $resource_options);
262 262
                 });
263 263
             }
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/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])->mapWithKeys(function ($media, $key) {
125
+                $medias = [
126
+                    $role => Collection::make($settingsFields['medias'][$role])->mapWithKeys(function($media, $key) {
127 127
                         return json_decode($media, true);
128 128
                     })->values()->filter()->toArray(),
129 129
                 ];
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/BlocksController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 
52 52
         $this->getChildrenPreview($block['blocks'], $blocksCollection, $newBlock->id, $blockId, $blockRepository);
53 53
 
54
-        $renderedBlocks = $blocksCollection->where('parent_id', null)->map(function ($block) use ($blocksCollection, $viewFactory, $config) {
54
+        $renderedBlocks = $blocksCollection->where('parent_id', null)->map(function($block) use ($blocksCollection, $viewFactory, $config) {
55 55
             if ($config->get('twill.block_editor.block_preview_render_childs') ?? true) {
56 56
                 $childBlocks = $blocksCollection->where('parent_id', $block->id);
57
-                $renderedChildViews = $childBlocks->map(function ($childBlock) use ($viewFactory, $config) {
57
+                $renderedChildViews = $childBlocks->map(function($childBlock) use ($viewFactory, $config) {
58 58
                     $view = $this->getBlockView($childBlock->type, $config);
59 59
 
60 60
                     return $viewFactory->exists($view) ? $viewFactory->make($view, [
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
     protected function getChildrenPreview($blocks, $blocksCollection, $parentId, &$blockId, $blockRepository)
110 110
     {
111
-        $blocks->each(function ($childBlock) use (&$blockId, $parentId, $blocksCollection, $blockRepository) {
111
+        $blocks->each(function($childBlock) use (&$blockId, $parentId, $blocksCollection, $blockRepository) {
112 112
             $childBlock['parent_id'] = $parentId;
113 113
             $blockId++;
114 114
             $newChildBlock = $blockRepository->createForPreview($childBlock);
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/Commands/ModuleMakeDeprecated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
     {
38 38
         $this->call('twill:make:module', [
39 39
             'moduleName' => $this->argument('moduleName'),
40
-        ] + collect($this->options())->mapWithKeys(function ($value, $key) {
40
+        ] + collect($this->options())->mapWithKeys(function($value, $key) {
41 41
             return ["--{$key}" => $value];
42 42
         })->toArray());
43 43
     }
Please login to merge, or discard this patch.
src/Models/Media.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,18 +22,18 @@  discard block
 block discarded – undo
22 22
 
23 23
     public function __construct(array $attributes = [])
24 24
     {
25
-        $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function ($field) {
25
+        $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function($field) {
26 26
             return $field['name'];
27 27
         })->toArray()));
28 28
 
29
-        Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function ($field) {
29
+        Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function($field) {
30 30
             $this->casts[$field] = 'json';
31 31
         });
32 32
 
33 33
         parent::__construct($attributes);
34 34
     }
35 35
 
36
-    public function scopeUnused ($query)
36
+    public function scopeUnused($query)
37 37
     {
38 38
         $usedIds = DB::table(config('twill.mediables_table'))->get()->pluck('media_id');
39 39
         return $query->whereNotIn('id', $usedIds->toArray())->get();
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             'medium' => ImageService::getUrl($this->uuid, ["h" => "430"]),
70 70
             'width' => $this->width,
71 71
             'height' => $this->height,
72
-            'tags' => $this->tags->map(function ($tag) {
72
+            'tags' => $this->tags->map(function($tag) {
73 73
                 return $tag->name;
74 74
             }),
75 75
             'deleteUrl' => $this->canDeleteSafely() ? moduleRoute('medias', 'media-library', 'destroy', $this->id) : null,
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                     'caption' => $this->caption,
82 82
                     'altText' => $this->alt_text,
83 83
                     'video' => null,
84
-                ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function ($field) {
84
+                ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function($field) {
85 85
                     return [
86 86
                         $field['name'] => $this->{$field['name']},
87 87
                     ];
Please login to merge, or discard this patch.
src/Models/File.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         return DB::table(config('twill.fileables_table', 'twill_fileables'))->where('file_id', $this->id)->count() === 0;
26 26
     }
27 27
 
28
-    public function scopeUnused ($query)
28
+    public function scopeUnused($query)
29 29
     {
30 30
         $usedIds = DB::table(config('twill.fileables_table'))->get()->pluck('file_id');
31 31
         return $query->whereNotIn('id', $usedIds->toArray())->get();
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
         return $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.