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 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $uploader) { |
| 133 | 133 | $uploadedValues = $uploader->uploadRepeatableFiles($values->pluck($uploader->getAttributeName())->toArray(), $this->getPreviousRepeatableValues($entry, $uploader)); |
| 134 | 134 | |
| 135 | - $values = $values->map(function ($item, $key) use ($uploadedValues, $uploader) { |
|
| 135 | + $values = $values->map(function($item, $key) use ($uploadedValues, $uploader) { |
|
| 136 | 136 | $item[$uploader->getAttributeName()] = $uploadedValues[$key] ?? null; |
| 137 | 137 | |
| 138 | 138 | return $item; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $values = $entry->{$this->getRepeatableContainerName()}; |
| 154 | 154 | $values = is_string($values) ? json_decode($values, true) : $values; |
| 155 | - $values = array_map(function ($item) use ($repeatableUploaders) { |
|
| 155 | + $values = array_map(function($item) use ($repeatableUploaders) { |
|
| 156 | 156 | foreach ($repeatableUploaders as $upload) { |
| 157 | 157 | $item[$upload->getAttributeName()] = $this->getValuesWithPathStripped($item, $upload); |
| 158 | 158 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | private function retrieveRepeatableRelationFiles(Model $entry) |
| 169 | 169 | { |
| 170 | - switch($this->getRepeatableRelationType()) { |
|
| 170 | + switch ($this->getRepeatableRelationType()) { |
|
| 171 | 171 | case 'BelongsToMany': |
| 172 | 172 | case 'MorphToMany': |
| 173 | 173 | $pivotClass = app('crud')->getModel()->{$this->getUploaderSubfield()['baseEntity']}()->getPivotClass(); |
@@ -213,12 +213,12 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $repeatableValues = collect($entry->{$this->getName()}); |
| 215 | 215 | foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $upload) { |
| 216 | - if (! $upload->shouldDeleteFiles()) { |
|
| 216 | + if (!$upload->shouldDeleteFiles()) { |
|
| 217 | 217 | continue; |
| 218 | 218 | } |
| 219 | 219 | $values = $repeatableValues->pluck($upload->getName())->toArray(); |
| 220 | 220 | foreach ($values as $value) { |
| 221 | - if (! $value) { |
|
| 221 | + if (!$value) { |
|
| 222 | 222 | continue; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /** |
| 242 | 242 | * Given two multidimensional arrays/collections, merge them recursively. |
| 243 | 243 | */ |
| 244 | - protected function mergeValuesRecursive(array|Collection $array1, array|Collection $array2): array|Collection |
|
| 244 | + protected function mergeValuesRecursive(array | Collection $array1, array | Collection $array2): array | Collection |
|
| 245 | 245 | { |
| 246 | 246 | $merged = $array1; |
| 247 | 247 | foreach ($array2 as $key => &$value) { |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | $items = CRUD::getRequest()->input('_order_'.$this->getRepeatableContainerName()) ?? []; |
| 265 | 265 | |
| 266 | - array_walk($items, function (&$key, $value) { |
|
| 266 | + array_walk($items, function(&$key, $value) { |
|
| 267 | 267 | $requestValue = $key[$this->getName()] ?? null; |
| 268 | 268 | $key = $this->handleMultipleFiles ? (is_string($requestValue) ? explode(',', $requestValue) : $requestValue) : $requestValue; |
| 269 | 269 | }); |
@@ -275,18 +275,18 @@ discard block |
||
| 275 | 275 | { |
| 276 | 276 | $previousValues = json_decode($entry->getOriginal($uploader->getRepeatableContainerName()), true); |
| 277 | 277 | |
| 278 | - if (! empty($previousValues)) { |
|
| 278 | + if (!empty($previousValues)) { |
|
| 279 | 279 | $previousValues = array_column($previousValues, $uploader->getName()); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | return $previousValues ?? []; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - private function getValuesWithPathStripped(array|string|null $item, UploaderInterface $uploader) |
|
| 285 | + private function getValuesWithPathStripped(array | string | null $item, UploaderInterface $uploader) |
|
| 286 | 286 | { |
| 287 | 287 | $uploadedValues = $item[$uploader->getName()] ?? null; |
| 288 | 288 | if (is_array($uploadedValues)) { |
| 289 | - return array_map(function ($value) use ($uploader) { |
|
| 289 | + return array_map(function($value) use ($uploader) { |
|
| 290 | 290 | return $uploader->getValueWithoutPath($value); |
| 291 | 291 | }, $uploadedValues); |
| 292 | 292 | } |
@@ -305,19 +305,19 @@ discard block |
||
| 305 | 305 | { |
| 306 | 306 | if (in_array($this->getRepeatableRelationType(), ['BelongsToMany', 'MorphToMany'])) { |
| 307 | 307 | $pivotAttributes = $entry->getAttributes(); |
| 308 | - $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function ($item) use ($pivotAttributes) { |
|
| 308 | + $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function($item) use ($pivotAttributes) { |
|
| 309 | 309 | $itemPivotAttributes = $item->pivot->only(array_keys($pivotAttributes)); |
| 310 | 310 | |
| 311 | 311 | return $itemPivotAttributes === $pivotAttributes; |
| 312 | 312 | })->first(); |
| 313 | 313 | |
| 314 | - if (! $connectedPivot) { |
|
| 314 | + if (!$connectedPivot) { |
|
| 315 | 315 | return; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | $files = $connectedPivot->getOriginal()['pivot_'.$this->getAttributeName()]; |
| 319 | 319 | |
| 320 | - if (! $files) { |
|
| 320 | + if (!$files) { |
|
| 321 | 321 | return; |
| 322 | 322 | } |
| 323 | 323 | |