We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | ], |
71 | 71 | |
72 | 72 | // CSS files that are loaded in all pages, using Laravel's mix() helper |
73 | - 'mix_styles' => [ // file_path => manifest_directory_path |
|
73 | + 'mix_styles' => [// file_path => manifest_directory_path |
|
74 | 74 | // 'css/app.css' => '', |
75 | 75 | ], |
76 | 76 | |
77 | 77 | // CSS files that are loaded in all pages, using Laravel's @vite() helper |
78 | 78 | // Please note that support for Vite was added in Laravel 9.19. Earlier versions are not able to use this feature. |
79 | - 'vite_styles' => [ // resource file_path |
|
79 | + 'vite_styles' => [// resource file_path |
|
80 | 80 | // 'resources/css/app.css', |
81 | 81 | ], |
82 | 82 | |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | ], |
153 | 153 | |
154 | 154 | // JS files that are loaded in all pages, using Laravel's mix() helper |
155 | - 'mix_scripts' => [ // file_path => manifest_directory_path |
|
155 | + 'mix_scripts' => [// file_path => manifest_directory_path |
|
156 | 156 | // 'js/app.js' => '', |
157 | 157 | ], |
158 | 158 | |
159 | 159 | // JS files that are loaded in all pages, using Laravel's @vite() helper |
160 | - 'vite_scripts' => [ // resource file_path |
|
160 | + 'vite_scripts' => [// resource file_path |
|
161 | 161 | // 'resources/js/app.js', |
162 | 162 | ], |
163 | 163 |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | * - when true: `address[street]` |
20 | 20 | * - when false: `[address][street]` |
21 | 21 | */ |
22 | -if (! Str::hasMacro('dotsToSquareBrackets')) { |
|
23 | - Str::macro('dotsToSquareBrackets', function ($string, $ignore = [], $keyFirst = true) { |
|
22 | +if (!Str::hasMacro('dotsToSquareBrackets')) { |
|
23 | + Str::macro('dotsToSquareBrackets', function($string, $ignore = [], $keyFirst = true) { |
|
24 | 24 | $stringParts = explode('.', $string); |
25 | 25 | $result = ''; |
26 | 26 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | return $result; |
35 | 35 | }); |
36 | 36 | } |
37 | -if (! CrudColumn::hasMacro('withFiles')) { |
|
38 | - CrudColumn::macro('withFiles', function ($uploadDefinition = [], $subfield = null) { |
|
37 | +if (!CrudColumn::hasMacro('withFiles')) { |
|
38 | + CrudColumn::macro('withFiles', function($uploadDefinition = [], $subfield = null) { |
|
39 | 39 | /** @var CrudField|CrudColumn $this */ |
40 | 40 | RegisterUploadEvents::handle($this, $uploadDefinition, 'withFiles', $subfield); |
41 | 41 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | }); |
44 | 44 | } |
45 | 45 | |
46 | -if (! CrudField::hasMacro('withFiles')) { |
|
47 | - CrudField::macro('withFiles', function ($uploadDefinition = [], $subfield = null) { |
|
46 | +if (!CrudField::hasMacro('withFiles')) { |
|
47 | + CrudField::macro('withFiles', function($uploadDefinition = [], $subfield = null) { |
|
48 | 48 | /** @var CrudField|CrudColumn $this */ |
49 | 49 | RegisterUploadEvents::handle($this, $uploadDefinition, 'withFiles', $subfield); |
50 | 50 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * |
59 | 59 | * It will go to the given CrudController and get the setupRoutes() method on it. |
60 | 60 | */ |
61 | -if (! Route::hasMacro('crud')) { |
|
62 | - Route::macro('crud', function ($name, $controller) { |
|
61 | +if (!Route::hasMacro('crud')) { |
|
62 | + Route::macro('crud', function($name, $controller) { |
|
63 | 63 | // put together the route name prefix, |
64 | 64 | // as passed to the Route::group() statements |
65 | 65 | $routeName = ''; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | $value = $value ?? CRUD::getRequest()->get($this->getName()); |
15 | 15 | $previousImage = $entry->getOriginal($this->getName()); |
16 | 16 | |
17 | - if (! $value && $previousImage) { |
|
17 | + if (!$value && $previousImage) { |
|
18 | 18 | Storage::disk($this->getDisk())->delete($previousImage); |
19 | 19 | |
20 | 20 | return null; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | foreach ($previousFiles as $row => $file) { |
29 | - if ($file && ! isset($orderedFiles[$row])) { |
|
29 | + if ($file && !isset($orderedFiles[$row])) { |
|
30 | 30 | $orderedFiles[$row] = null; |
31 | 31 | Storage::disk($this->getDisk())->delete($file); |
32 | 32 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return $this->getPath().$fileName; |
53 | 53 | } |
54 | 54 | |
55 | - if (! $value && CrudPanelFacade::getRequest()->has($this->getName()) && $previousFile) { |
|
55 | + if (!$value && CrudPanelFacade::getRequest()->has($this->getName()) && $previousFile) { |
|
56 | 56 | Storage::disk($this->getDisk())->delete($previousFile); |
57 | 57 | |
58 | 58 | return null; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function markAsHandled(string $objectName) |
41 | 41 | { |
42 | - if (! in_array($objectName, $this->handledUploaders)) { |
|
42 | + if (!in_array($objectName, $this->handledUploaders)) { |
|
43 | 43 | $this->handledUploaders[] = $objectName; |
44 | 44 | } |
45 | 45 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function registerUploader(string $uploadName, UploaderInterface $uploader) |
113 | 113 | { |
114 | - if (! array_key_exists($uploadName, $this->registeredUploaders) || ! in_array($uploader, $this->registeredUploaders[$uploadName])) { |
|
114 | + if (!array_key_exists($uploadName, $this->registeredUploaders) || !in_array($uploader, $this->registeredUploaders[$uploadName])) { |
|
115 | 115 | $this->registeredUploaders[$uploadName][] = $uploader; |
116 | 116 | } |
117 | 117 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function getRegisteredUploadNames(string $uploadName) |
160 | 160 | { |
161 | - return array_map(function ($uploader) { |
|
161 | + return array_map(function($uploader) { |
|
162 | 162 | return $uploader->getName(); |
163 | 163 | }, $this->getRegisteredUploadersFor($uploadName)); |
164 | 164 | } |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | private string $crudObjectType; |
14 | 14 | |
15 | 15 | public function __construct( |
16 | - private readonly CrudField|CrudColumn $crudObject, |
|
16 | + private readonly CrudField | CrudColumn $crudObject, |
|
17 | 17 | private readonly array $uploaderConfiguration, |
18 | 18 | private readonly string $macro |
19 | 19 | ) { |
20 | 20 | $this->crudObjectType = is_a($crudObject, CrudField::class) ? 'field' : (is_a($crudObject, CrudColumn::class) ? 'column' : null); |
21 | 21 | |
22 | - if (! $this->crudObjectType) { |
|
22 | + if (!$this->crudObjectType) { |
|
23 | 23 | abort(500, 'Upload handlers only work for CrudField and CrudColumn classes.'); |
24 | 24 | } |
25 | 25 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | if ($this->crudObjectType === 'field') { |
59 | - $model::saving(function ($entry) use ($uploader) { |
|
59 | + $model::saving(function($entry) use ($uploader) { |
|
60 | 60 | $updatedCountKey = 'uploaded_'.($uploader->getRepeatableContainerName() ?? $uploader->getName()).'_count'; |
61 | 61 | |
62 | 62 | CRUD::set($updatedCountKey, CRUD::get($updatedCountKey) ?? 0); |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | }); |
70 | 70 | } |
71 | 71 | |
72 | - $model::retrieved(function ($entry) use ($uploader) { |
|
72 | + $model::retrieved(function($entry) use ($uploader) { |
|
73 | 73 | $entry = $uploader->retrieveUploadedFile($entry); |
74 | 74 | }); |
75 | 75 | |
76 | - $model::deleting(function ($entry) use ($uploader) { |
|
76 | + $model::deleting(function($entry) use ($uploader) { |
|
77 | 77 | $uploader->deleteUploadedFile($entry); |
78 | 78 | }); |
79 | 79 | |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @param array|null $subfield |
87 | 87 | * @return void |
88 | 88 | */ |
89 | - public function registerEvents(array|null $subfield = []) |
|
89 | + public function registerEvents(array | null $subfield = []) |
|
90 | 90 | { |
91 | - if (! empty($subfield)) { |
|
91 | + if (!empty($subfield)) { |
|
92 | 92 | $this->registerSubfieldEvent($subfield); |
93 | 93 | |
94 | 94 | return; |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | |
136 | 136 | // for subfields, we only register one event so that we have access to the repeatable container name. |
137 | 137 | // all the uploaders for a given container are stored in the UploadersRepository. |
138 | - if (! app('UploadersRepository')->hasUploadersRegisteredFor($uploader->getRepeatableContainerName())) { |
|
138 | + if (!app('UploadersRepository')->hasUploadersRegisteredFor($uploader->getRepeatableContainerName())) { |
|
139 | 139 | $this->setupModelEvents($model, $uploader); |
140 | 140 | } |
141 | 141 | |
142 | 142 | $subfields = collect($this->crudObject->getAttributes()['subfields']); |
143 | - $subfields = $subfields->map(function ($item) use ($subfield, $uploader) { |
|
143 | + $subfields = $subfields->map(function($item) use ($subfield, $uploader) { |
|
144 | 144 | if ($item['name'] === $subfield['name']) { |
145 | 145 | $item['upload'] = true; |
146 | 146 | $item['disk'] = $uploader->getDisk(); |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | private function getUploader(array $crudObject, array $uploaderConfiguration) |
177 | 177 | { |
178 | 178 | if (isset($uploaderConfiguration['uploaderType'])) { |
179 | - return $uploaderConfiguration['uploaderType']::for($crudObject, $uploaderConfiguration); |
|
179 | + return $uploaderConfiguration['uploaderType']::for ($crudObject, $uploaderConfiguration); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | if (app('UploadersRepository')->hasUploadFor($crudObject['type'], $this->macro)) { |
183 | - return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for($crudObject, $uploaderConfiguration); |
|
183 | + return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for ($crudObject, $uploaderConfiguration); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | throw new Exception('Undefined upload type for '.$this->crudObjectType.' type: '.$crudObject['type']); |
@@ -31,11 +31,11 @@ |
||
31 | 31 | { |
32 | 32 | $fileGeneratorClass = $fileNameGenerator ?? config('backpack.crud.file_name_generator'); |
33 | 33 | |
34 | - if (! class_exists($fileGeneratorClass)) { |
|
34 | + if (!class_exists($fileGeneratorClass)) { |
|
35 | 35 | throw new \Exception("The file name generator class [{$fileGeneratorClass}] does not exist."); |
36 | 36 | } |
37 | 37 | |
38 | - if (! class_implements($fileGeneratorClass, FileNameGeneratorInterface::class)) { |
|
38 | + if (!class_implements($fileGeneratorClass, FileNameGeneratorInterface::class)) { |
|
39 | 39 | throw new \Exception("The file name generator class [{$fileGeneratorClass}] must implement the [".FileNameGeneratorInterface::class.'] interface.'); |
40 | 40 | } |
41 | 41 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | foreach (app('UploadersRepository')->getRegisteredUploadersFor($this->repeatableContainerName) as $uploader) { |
115 | 115 | $uploadedValues = $uploader->uploadRepeatableFile($entry, $value->pluck($uploader->getName())->toArray()); |
116 | 116 | |
117 | - $value = $value->map(function ($item, $key) use ($uploadedValues, $uploader) { |
|
117 | + $value = $value->map(function($item, $key) use ($uploadedValues, $uploader) { |
|
118 | 118 | $item[$uploader->getName()] = $uploadedValues[$key] ?? null; |
119 | 119 | |
120 | 120 | return $item; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | protected function getPreviousRepeatableValues(Model $entry) |
134 | 134 | { |
135 | 135 | $previousValues = json_decode($entry->getOriginal($this->repeatableContainerName), true); |
136 | - if (! empty($previousValues)) { |
|
136 | + if (!empty($previousValues)) { |
|
137 | 137 | $previousValues = array_column($previousValues, $this->getName()); |
138 | 138 | } |
139 | 139 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | $items = CRUD::getRequest()->input('_order_'.$this->repeatableContainerName) ?? []; |
152 | 152 | |
153 | - array_walk($items, function (&$key, $value) { |
|
153 | + array_walk($items, function(&$key, $value) { |
|
154 | 154 | $requestValue = $key[$this->getName()] ?? null; |
155 | 155 | $key = $this->isMultiple ? (is_string($requestValue) ? explode(',', $requestValue) : $requestValue) : $requestValue; |
156 | 156 | }); |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | |
190 | 190 | $repeatableValues = collect($entry->{$this->getName()}); |
191 | 191 | foreach (app('UploadersRepository')->getRegisteredUploadersFor($this->repeatableContainerName) as $upload) { |
192 | - if (! $upload->shouldDeleteFiles()) { |
|
192 | + if (!$upload->shouldDeleteFiles()) { |
|
193 | 193 | continue; |
194 | 194 | } |
195 | 195 | $values = $repeatableValues->pluck($upload->getName())->toArray(); |
196 | 196 | foreach ($values as $value) { |
197 | - if (! $value) { |
|
197 | + if (!$value) { |
|
198 | 198 | continue; |
199 | 199 | } |
200 | 200 | if (is_array($value)) { |
@@ -46,7 +46,7 @@ |
||
46 | 46 | if (isset($attributes['subfields'])) { |
47 | 47 | foreach ($attributes['subfields'] as $subfield) { |
48 | 48 | if (isset($subfield[$macro])) { |
49 | - $config = ! is_array($subfield[$macro]) ? [] : $subfield[$macro]; |
|
49 | + $config = !is_array($subfield[$macro]) ? [] : $subfield[$macro]; |
|
50 | 50 | $this->{$macro}($config, $subfield); |
51 | 51 | } |
52 | 52 | } |