We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | public bool $handleRepeatableFiles = false; |
| 16 | 16 | |
| 17 | - public null|string $repeatableContainerName = null; |
|
| 17 | + public null | string $repeatableContainerName = null; |
|
| 18 | 18 | |
| 19 | 19 | /******************************* |
| 20 | 20 | * Setters - fluently configure the uploader |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /******************************* |
| 32 | 32 | * Getters |
| 33 | 33 | *******************************/ |
| 34 | - public function getRepeatableContainerName(): null|string |
|
| 34 | + public function getRepeatableContainerName(): null | string |
|
| 35 | 35 | { |
| 36 | 36 | return $this->repeatableContainerName; |
| 37 | 37 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $uploader) { |
| 140 | 140 | $uploadedValues = $uploader->uploadRepeatableFiles($values->pluck($uploader->getAttributeName())->toArray(), $this->getPreviousRepeatableValues($entry, $uploader)); |
| 141 | 141 | |
| 142 | - $values = $values->map(function ($item, $key) use ($uploadedValues, $uploader) { |
|
| 142 | + $values = $values->map(function($item, $key) use ($uploadedValues, $uploader) { |
|
| 143 | 143 | $item[$uploader->getAttributeName()] = $uploadedValues[$key] ?? null; |
| 144 | 144 | |
| 145 | 145 | return $item; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | $values = $entry->{$this->getRepeatableContainerName()}; |
| 161 | 161 | $values = is_string($values) ? json_decode($values, true) : $values; |
| 162 | - $values = array_map(function ($item) use ($repeatableUploaders) { |
|
| 162 | + $values = array_map(function($item) use ($repeatableUploaders) { |
|
| 163 | 163 | foreach ($repeatableUploaders as $upload) { |
| 164 | 164 | $item[$upload->getAttributeName()] = $this->getValuesWithPathStripped($item, $upload); |
| 165 | 165 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | private function retrieveRepeatableRelationFiles(Model $entry) |
| 176 | 176 | { |
| 177 | - switch($this->getRepeatableRelationType()) { |
|
| 177 | + switch ($this->getRepeatableRelationType()) { |
|
| 178 | 178 | case 'BelongsToMany': |
| 179 | 179 | case 'MorphToMany': |
| 180 | 180 | $pivotClass = app('crud')->getModel()->{$this->getUploaderSubfield()['baseEntity']}()->getPivotClass(); |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | $repeatableValues = collect($entry->{$this->getName()}); |
| 222 | 222 | foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $upload) { |
| 223 | - if (! $upload->shouldDeleteFiles()) { |
|
| 223 | + if (!$upload->shouldDeleteFiles()) { |
|
| 224 | 224 | continue; |
| 225 | 225 | } |
| 226 | 226 | $values = $repeatableValues->pluck($upload->getName())->toArray(); |
| 227 | 227 | foreach ($values as $value) { |
| 228 | - if (! $value) { |
|
| 228 | + if (!$value) { |
|
| 229 | 229 | continue; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | /** |
| 249 | 249 | * Given two multidimensional arrays/collections, merge them recursively. |
| 250 | 250 | */ |
| 251 | - protected function mergeValuesRecursive(array|Collection $array1, array|Collection $array2): array|Collection |
|
| 251 | + protected function mergeValuesRecursive(array | Collection $array1, array | Collection $array2): array | Collection |
|
| 252 | 252 | { |
| 253 | 253 | $merged = $array1; |
| 254 | 254 | foreach ($array2 as $key => &$value) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | { |
| 271 | 271 | $items = CRUD::getRequest()->input('_order_'.$this->getRepeatableContainerName()) ?? []; |
| 272 | 272 | |
| 273 | - array_walk($items, function (&$key, $value) { |
|
| 273 | + array_walk($items, function(&$key, $value) { |
|
| 274 | 274 | $requestValue = $key[$this->getName()] ?? null; |
| 275 | 275 | $key = $this->handleMultipleFiles ? (is_string($requestValue) ? explode(',', $requestValue) : $requestValue) : $requestValue; |
| 276 | 276 | }); |
@@ -282,22 +282,22 @@ discard block |
||
| 282 | 282 | { |
| 283 | 283 | $previousValues = $entry->getOriginal($uploader->getRepeatableContainerName()); |
| 284 | 284 | |
| 285 | - if( !is_array($previousValues)) { |
|
| 285 | + if (!is_array($previousValues)) { |
|
| 286 | 286 | $previousValues = json_decode($previousValues, true); |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - if (! empty($previousValues)) { |
|
| 289 | + if (!empty($previousValues)) { |
|
| 290 | 290 | $previousValues = array_column($previousValues, $uploader->getName()); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | return $previousValues ?? []; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - private function getValuesWithPathStripped(array|string|null $item, UploaderInterface $uploader) |
|
| 296 | + private function getValuesWithPathStripped(array | string | null $item, UploaderInterface $uploader) |
|
| 297 | 297 | { |
| 298 | 298 | $uploadedValues = $item[$uploader->getName()] ?? null; |
| 299 | 299 | if (is_array($uploadedValues)) { |
| 300 | - return array_map(function ($value) use ($uploader) { |
|
| 300 | + return array_map(function($value) use ($uploader) { |
|
| 301 | 301 | return $uploader->getValueWithoutPath($value); |
| 302 | 302 | }, $uploadedValues); |
| 303 | 303 | } |
@@ -316,19 +316,19 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | if (in_array($this->getRepeatableRelationType(), ['BelongsToMany', 'MorphToMany'])) { |
| 318 | 318 | $pivotAttributes = $entry->getAttributes(); |
| 319 | - $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function ($item) use ($pivotAttributes) { |
|
| 319 | + $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function($item) use ($pivotAttributes) { |
|
| 320 | 320 | $itemPivotAttributes = $item->pivot->only(array_keys($pivotAttributes)); |
| 321 | 321 | |
| 322 | 322 | return $itemPivotAttributes === $pivotAttributes; |
| 323 | 323 | })->first(); |
| 324 | 324 | |
| 325 | - if (! $connectedPivot) { |
|
| 325 | + if (!$connectedPivot) { |
|
| 326 | 326 | return; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | $files = $connectedPivot->getOriginal()['pivot_'.$this->getAttributeName()]; |
| 330 | 330 | |
| 331 | - if (! $files) { |
|
| 331 | + if (!$files) { |
|
| 332 | 332 | return; |
| 333 | 333 | } |
| 334 | 334 | |