Passed
Pull Request — 1.1 (#17)
by Quentin
04:56
created
src/Http/Controllers/Admin/FeaturedController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
         $featuredSources = $this->getFeaturedSources($featuredSection, $filters['search'] ?? '');
20 20
 
21
-        $contentTypes = collect($featuredSources)->map(function ($source, $sourceKey) {
21
+        $contentTypes = collect($featuredSources)->map(function($source, $sourceKey) {
22 22
             return [
23 23
                 'label' => $source['name'],
24 24
                 'value' => $sourceKey,
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
         })->values()->toArray();
27 27
 
28 28
         if (request()->has('content_type')) {
29
-            $source = array_first($featuredSources, function ($source, $sourceKey) {
29
+            $source = array_first($featuredSources, function($source, $sourceKey) {
30 30
                 return $sourceKey == request('content_type');
31 31
             });
32 32
 
33 33
             return [
34 34
                 'source' => [
35
-                    'content_type' => array_first($contentTypes, function ($contentTypeItem) {
35
+                    'content_type' => array_first($contentTypes, function($contentTypeItem) {
36 36
                         return $contentTypeItem['value'] == request('content_type');
37 37
                     }),
38 38
                     'items' => $source['items'],
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         $bucketRouteConfig = config('twill.bucketsRoutes') ?? [$featuredSectionKey => 'featured'];
75 75
 
76
-        return collect($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) {
76
+        return collect($featuredSection['buckets'])->map(function($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) {
77 77
             $routePrefix = $bucketRouteConfig[$featuredSectionKey];
78 78
 
79 79
             return [
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 'acceptedSources'      => collect($bucket['bucketables'])->pluck('module'),
84 84
                 'withToggleFeatured'   => $bucket['with_starred_items'] ?? false,
85 85
                 'toggleFeaturedLabels' => $bucket['starred_items_labels'] ?? [],
86
-                'children'             => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function ($feature) {
86
+                'children'             => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function($feature) {
87 87
                     if (($item = $feature->featured) != null) {
88 88
                         $repository = $this->getRepository($feature->featured_type);
89 89
                         $withImage = classHasTrait($repository, HandleMedias::class);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                             'thumbnail' => $item->defaultCmsImage(['w' => 100, 'h' => 100]),
102 102
                         ] : []);
103 103
                     }
104
-                })->reject(function ($item) {
104
+                })->reject(function($item) {
105 105
                     return is_null($item);
106 106
                 })->values()->toArray(),
107 107
             ];
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
         $fetchedModules = [];
114 114
         $featuredSources = [];
115 115
 
116
-        collect($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use (&$fetchedModules, $search) {
117
-            return collect($bucket['bucketables'])->mapWithKeys(function ($bucketable) use (&$fetchedModules, $bucketKey, $search) {
116
+        collect($featuredSection['buckets'])->map(function($bucket, $bucketKey) use (&$fetchedModules, $search) {
117
+            return collect($bucket['bucketables'])->mapWithKeys(function($bucketable) use (&$fetchedModules, $bucketKey, $search) {
118 118
                 $module = $bucketable['module'];
119 119
                 $repository = $this->getRepository($module);
120 120
                 $translated = classHasTrait($repository, HandleTranslations::class);
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
                     'withImage'  => $withImage,
143 143
                 ]];
144 144
             });
145
-        })->each(function ($bucketables, $bucket) use (&$featuredSources) {
146
-            $bucketables->each(function ($bucketableData, $bucketable) use ($bucket, &$featuredSources) {
145
+        })->each(function($bucketables, $bucket) use (&$featuredSources) {
146
+            $bucketables->each(function($bucketableData, $bucketable) use ($bucket, &$featuredSources) {
147 147
                 $featuredSources[$bucketable]['name'] = $bucketableData['name'];
148 148
                 $featuredSources[$bucketable]['maxPage'] = $bucketableData['items']->lastPage();
149 149
                 $featuredSources[$bucketable]['offset'] = $bucketableData['items']->perPage();
150
-                $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function ($item) use ($bucketableData, $bucketable) {
150
+                $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function($item) use ($bucketableData, $bucketable) {
151 151
                     return [
152 152
                         'id'           => $item->id,
153 153
                         'name'         => $item->titleInBucket ?? $item->title,
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 
171 171
     public function save()
172 172
     {
173
-        DB::transaction(function () {
174
-            collect(request('buckets'))->each(function ($bucketables, $bucketKey) {
173
+        DB::transaction(function() {
174
+            collect(request('buckets'))->each(function($bucketables, $bucketKey) {
175 175
                 Feature::where('bucket_key', $bucketKey)->delete();
176 176
                 foreach (($bucketables ?? []) as $position => $bucketable) {
177 177
                     Feature::create([
@@ -190,6 +190,6 @@  discard block
 block discarded – undo
190 190
 
191 191
     private function getRepository($bucketable)
192 192
     {
193
-        return app(config('twill.namespace')."\Repositories\\".ucfirst(str_singular($bucketable)).'Repository');
193
+        return app(config('twill.namespace') . "\Repositories\\" . ucfirst(str_singular($bucketable)) . 'Repository');
194 194
     }
195 195
 }
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/FileLibraryController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $items = $this->getIndexItems($scopes);
51 51
 
52 52
         return [
53
-            'items' => $items->map(function ($item) {
53
+            'items' => $items->map(function($item) {
54 54
                 return $this->buildFile($item);
55 55
             })->toArray(),
56 56
             'maxPage' => $items->lastPage(),
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     private function buildFile($item)
63 63
     {
64 64
         return $item->toCmsArray() + [
65
-            'tags' => $item->tags->map(function ($tag) {
65
+            'tags' => $item->tags->map(function($tag) {
66 66
                 return $tag->name;
67 67
             }),
68 68
             'deleteUrl'     => $item->canDeleteSafely() ? moduleRoute($this->moduleName, $this->routePrefix, 'destroy', $item->id) : null,
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
         $filename = $request->input('qqfilename');
104 104
         $cleanFilename = preg_replace("/\s+/i", '-', $filename);
105 105
 
106
-        $fileDirectory = public_path(config('twill.file_library.local_path').$request->input('unique_folder_name'));
106
+        $fileDirectory = public_path(config('twill.file_library.local_path') . $request->input('unique_folder_name'));
107 107
 
108 108
         $request->file('qqfile')->move($fileDirectory, $cleanFilename);
109 109
 
110 110
         $fields = [
111
-            'uuid'     => $request->input('unique_folder_name').'/'.$cleanFilename,
111
+            'uuid'     => $request->input('unique_folder_name') . '/' . $cleanFilename,
112 112
             'filename' => $cleanFilename,
113 113
             'size'     => $request->input('qqtotalfilesize'),
114 114
         ];
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $items = $this->getIndexItems($scopes);
152 152
 
153 153
         return response()->json([
154
-            'items' => $items->map(function ($item) {
154
+            'items' => $items->map(function($item) {
155 155
                 return $this->buildFile($item);
156 156
             })->toArray(),
157 157
             'tags' => $this->repository->getTagsList(),
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/TemplatesController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
 
12 12
     public function view($view)
13 13
     {
14
-        return view('templates.'.$view);
14
+        return view('templates.' . $view);
15 15
     }
16 16
 
17 17
     public function xhr($view)
18 18
     {
19 19
         $response = [
20
-            'data'     => view('templates.'.$view)->render(),
20
+            'data'     => view('templates.' . $view)->render(),
21 21
             'has_more' => (rand(0, 10) > 5),
22 22
         ];
23 23
 
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/BlocksController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 
36 36
         $blocksCollection->push($newBlock);
37 37
 
38
-        $block['blocks']->each(function ($childBlock) use ($newBlock, $blocksCollection, $blockRepository) {
38
+        $block['blocks']->each(function($childBlock) use ($newBlock, $blocksCollection, $blockRepository) {
39 39
             $childBlock['parent_id'] = $newBlock->id;
40 40
             $newChildBlock = $blockRepository->createForPreview($childBlock);
41 41
             $blocksCollection->push($newChildBlock);
42 42
         });
43 43
 
44
-        $renderedBlocks = $blocksCollection->where('parent_id', null)->map(function ($block) use ($blocksCollection) {
44
+        $renderedBlocks = $blocksCollection->where('parent_id', null)->map(function($block) use ($blocksCollection) {
45 45
             if (config('twill.block_editor.block_preview_render_childs') ?? true) {
46 46
                 $childBlocks = $blocksCollection->where('parent_id', $block->id);
47
-                $renderedChildViews = $childBlocks->map(function ($childBlock) {
47
+                $renderedChildViews = $childBlocks->map(function($childBlock) {
48 48
                     $view = $this->getBlockView($childBlock->type);
49 49
 
50 50
                     return view($view)->with('block', $childBlock)->render();
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
             $view = $this->getBlockView($block->type);
57 57
 
58
-            return view($view)->with('block', $block)->render().($renderedChildViews ?? '');
58
+            return view($view)->with('block', $block)->render() . ($renderedChildViews ?? '');
59 59
         })->implode('');
60 60
 
61 61
         $view = view(config('twill.block_editor.block_single_layout'));
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     private function getBlockView($blockType)
69 69
     {
70
-        $view = config('twill.block_editor.block_views_path').'.'.$blockType;
70
+        $view = config('twill.block_editor.block_views_path') . '.' . $blockType;
71 71
 
72 72
         $customViews = config('twill.block_editor.block_views_mappings');
73 73
 
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/MediaLibraryController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $items = $this->getIndexItems($scopes);
51 51
 
52 52
         return [
53
-            'items' => $items->map(function ($item) {
53
+            'items' => $items->map(function($item) {
54 54
                 return $this->buildMedia($item);
55 55
             })->toArray(),
56 56
             'maxPage' => $items->lastPage(),
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     private function buildMedia($item)
63 63
     {
64 64
         return $item->toCmsArray() + [
65
-            'tags' => $item->tags->map(function ($tag) {
65
+            'tags' => $item->tags->map(function($tag) {
66 66
                 return $tag->name;
67 67
             }),
68 68
             'deleteUrl'     => $item->canDeleteSafely() ? moduleRoute($this->moduleName, $this->routePrefix, 'destroy', $item->id) : null,
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 
117 117
         $filename = sanitizeFilename($originalFilename);
118 118
 
119
-        $fileDirectory = public_path(config('twill.media_library.local_path').$request->input('unique_folder_name'));
119
+        $fileDirectory = public_path(config('twill.media_library.local_path') . $request->input('unique_folder_name'));
120 120
 
121 121
         $request->file('qqfile')->move($fileDirectory, $filename);
122 122
 
123
-        list($w, $h) = getimagesize($fileDirectory.'/'.$filename);
123
+        list($w, $h) = getimagesize($fileDirectory . '/' . $filename);
124 124
 
125 125
         $fields = [
126
-            'uuid'     => config('twill.media_library.local_path').$request->input('unique_folder_name').'/'.$filename,
126
+            'uuid'     => config('twill.media_library.local_path') . $request->input('unique_folder_name') . '/' . $filename,
127 127
             'filename' => $originalFilename,
128 128
             'width'    => $w,
129 129
             'height'   => $h,
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $items = $this->getIndexItems($scopes);
172 172
 
173 173
         return response()->json([
174
-            'items' => $items->map(function ($item) {
174
+            'items' => $items->map(function($item) {
175 175
                 return $this->buildMedia($item);
176 176
             })->toArray(),
177 177
             'tags' => $this->repository->getTagsList(),
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/SettingController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@
 block discarded – undo
15 15
 
16 16
     public function index($section)
17 17
     {
18
-        return view()->exists('admin.settings.'.$section) ? view('admin.settings.'.$section, [
18
+        return view()->exists('admin.settings.' . $section) ? view('admin.settings.' . $section, [
19 19
             'customForm'    => true,
20 20
             'editableTitle' => false,
21
-            'customTitle'   => ucfirst($section).' settings',
21
+            'customTitle'   => ucfirst($section) . ' settings',
22 22
             'section'       => $section,
23 23
             'form_fields'   => $this->settings->getFormFields($section),
24 24
             'saveUrl'       => route('admin.settings.update', $section),
Please login to merge, or discard this patch.
src/Http/Controllers/Front/ShowWithPreview.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@
 block discarded – undo
15 15
         }
16 16
 
17 17
         if (!isset($this->showViewName)) {
18
-            $this->showViewName = 'site.'.str_singular($this->moduleName);
18
+            $this->showViewName = 'site.' . str_singular($this->moduleName);
19 19
         }
20 20
 
21
-        if (ends_with(request()->route()->getName(), $this->routeName.'.preview')) {
21
+        if (ends_with(request()->route()->getName(), $this->routeName . '.preview')) {
22 22
             $item = $this->getItemPreview($slug);
23 23
         }
24 24
 
25
-        abort_unless($item = ($item ?? $this->getItem($slug)), 404, ucfirst($this->moduleName).' not found');
25
+        abort_unless($item = ($item ?? $this->getItem($slug)), 404, ucfirst($this->moduleName) . ' not found');
26 26
 
27 27
         if ($item->redirect) {
28
-            return redirect()->to(route($this->routeName.'.show', $item->getSlug()));
28
+            return redirect()->to(route($this->routeName . '.show', $item->getSlug()));
29 29
         }
30 30
 
31 31
         return view($this->showViewName, [
Please login to merge, or discard this patch.
src/Http/ViewComposers/MediasUploaderConfig.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
             'endpoint'          => $endpointType === 'local' ? route('admin.media-library.medias.store') : s3Endpoint($libraryDisk),
18 18
             'successEndpoint'   => route('admin.media-library.medias.store'),
19 19
             'signatureEndpoint' => route('admin.media-library.sign-s3-upload'),
20
-            'endpointBucket'    => config('filesystems.disks.'.$libraryDisk.'.bucket', 'none'),
21
-            'endpointRegion'    => config('filesystems.disks.'.$libraryDisk.'.region', 'none'),
22
-            'accessKey'         => config('filesystems.disks.'.$libraryDisk.'.key', 'none'),
20
+            'endpointBucket'    => config('filesystems.disks.' . $libraryDisk . '.bucket', 'none'),
21
+            'endpointRegion'    => config('filesystems.disks.' . $libraryDisk . '.region', 'none'),
22
+            'accessKey'         => config('filesystems.disks.' . $libraryDisk . '.key', 'none'),
23 23
             'csrfToken'         => csrf_token(),
24 24
             'acl'               => config('twill.media_library.acl'),
25 25
             'filesizeLimit'     => config('twill.media_library.filesize_limit'),
Please login to merge, or discard this patch.
src/Http/ViewComposers/FilesUploaderConfig.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
             'endpoint'          => $endpointType === 'local' ? route('admin.file-library.files.store') : s3Endpoint($libraryDisk),
18 18
             'successEndpoint'   => route('admin.file-library.files.store'),
19 19
             'signatureEndpoint' => route('admin.file-library.sign-s3-upload'),
20
-            'endpointBucket'    => config('filesystems.disks.'.$libraryDisk.'.bucket', 'none'),
21
-            'endpointRegion'    => config('filesystems.disks.'.$libraryDisk.'.region', 'none'),
22
-            'accessKey'         => config('filesystems.disks.'.$libraryDisk.'.key', 'none'),
20
+            'endpointBucket'    => config('filesystems.disks.' . $libraryDisk . '.bucket', 'none'),
21
+            'endpointRegion'    => config('filesystems.disks.' . $libraryDisk . '.region', 'none'),
22
+            'accessKey'         => config('filesystems.disks.' . $libraryDisk . '.key', 'none'),
23 23
             'csrfToken'         => csrf_token(),
24 24
             'acl'               => config('twill.file_library.acl'),
25 25
             'filesizeLimit'     => config('twill.file_library.filesize_limit'),
Please login to merge, or discard this patch.