We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | private bool $deleteWhenEntryIsDeleted = true; |
| 27 | 27 | |
| 28 | - private bool|string $attachedToFakeField = false; |
|
| 28 | + private bool | string $attachedToFakeField = false; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Cloud disks have the ability to generate temporary URLs to files, should we do it? |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | /******************************* |
| 63 | 63 | * Static methods |
| 64 | 64 | *******************************/ |
| 65 | - public static function for(array $crudObject, array $definition): UploaderInterface |
|
| 65 | + public static function for (array $crudObject, array $definition): UploaderInterface |
|
| 66 | 66 | { |
| 67 | 67 | return new static($crudObject, $definition); |
| 68 | 68 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | public function deleteUploadedFiles(Model $entry): void |
| 104 | 104 | { |
| 105 | 105 | if ($this->deleteWhenEntryIsDeleted) { |
| 106 | - if (! in_array(SoftDeletes::class, class_uses_recursive($entry), true)) { |
|
| 106 | + if (!in_array(SoftDeletes::class, class_uses_recursive($entry), true)) { |
|
| 107 | 107 | $this->performFileDeletion($entry); |
| 108 | 108 | |
| 109 | 109 | return; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | public function getPreviousFiles(Model $entry): mixed |
| 181 | 181 | { |
| 182 | - if (! $this->attachedToFakeField) { |
|
| 182 | + if (!$this->attachedToFakeField) { |
|
| 183 | 183 | return $this->getOriginalValue($entry); |
| 184 | 184 | } |
| 185 | 185 | $value = $this->getOriginalValue($entry, $this->attachedToFakeField); |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | return $this->attachedToFakeField !== false; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - public function getFakeAttribute(): bool|string |
|
| 201 | + public function getFakeAttribute(): bool | string |
|
| 202 | 202 | { |
| 203 | 203 | return $this->attachedToFakeField; |
| 204 | 204 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | return $this; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - public function fake(bool|string $isFake): self |
|
| 223 | + public function fake(bool | string $isFake): self |
|
| 224 | 224 | { |
| 225 | 225 | $this->attachedToFakeField = $isFake; |
| 226 | 226 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | if ($this->handleMultipleFiles) { |
| 254 | - if (! isset($entry->getCasts()[$this->getName()]) && is_string($value)) { |
|
| 254 | + if (!isset($entry->getCasts()[$this->getName()]) && is_string($value)) { |
|
| 255 | 255 | $entry->{$this->getAttributeName()} = json_decode($value, true); |
| 256 | 256 | } |
| 257 | 257 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | private function deleteFiles(Model $entry) |
| 267 | 267 | { |
| 268 | - if (! $this->shouldDeleteFiles()) { |
|
| 268 | + if (!$this->shouldDeleteFiles()) { |
|
| 269 | 269 | return; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | if ($this->handleMultipleFiles) { |
| 285 | 285 | // ensure we have an array of values when field is not casted in model. |
| 286 | - if (! isset($entry->getCasts()[$this->name]) && is_string($values)) { |
|
| 286 | + if (!isset($entry->getCasts()[$this->name]) && is_string($values)) { |
|
| 287 | 287 | $values = json_decode($values, true); |
| 288 | 288 | } |
| 289 | 289 | foreach ($values ?? [] as $value) { |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | private function performFileDeletion(Model $entry) |
| 302 | 302 | { |
| 303 | - if (! $this->handleRepeatableFiles) { |
|
| 303 | + if (!$this->handleRepeatableFiles) { |
|
| 304 | 304 | $this->deleteFiles($entry); |
| 305 | 305 | |
| 306 | 306 | return; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | $previousValue = $entry->getOriginal($field); |
| 331 | 331 | |
| 332 | - if (! $previousValue) { |
|
| 332 | + if (!$previousValue) { |
|
| 333 | 333 | return $previousValue; |
| 334 | 334 | } |
| 335 | 335 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | '_method' => 'PUT', |
| 90 | 90 | 'upload' => $this->getUploadedFile('avatar4.jpg'), |
| 91 | 91 | 'upload_multiple' => $this->getUploadedFiles(['avatar5.jpg', 'avatar6.jpg']), |
| 92 | - 'clear_upload_multiple' => ['avatar2.jpg', 'avatar3.jpg'], |
|
| 92 | + 'clear_upload_multiple' => ['avatar2.jpg', 'avatar3.jpg'], |
|
| 93 | 93 | 'id' => 1, |
| 94 | 94 | ]); |
| 95 | 95 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $this->assertDatabaseCount('uploaders', 1); |
| 170 | 170 | |
| 171 | 171 | $this->assertDatabaseHas('uploaders', [ |
| 172 | - 'extras' => json_encode(['upload_multiple' => ['avatar2.jpg', 'avatar3.jpg'], 'upload' => 'avatar1.jpg']), |
|
| 172 | + 'extras' => json_encode(['upload_multiple' => ['avatar2.jpg', 'avatar3.jpg'], 'upload' => 'avatar1.jpg']), |
|
| 173 | 173 | ]); |
| 174 | 174 | |
| 175 | 175 | $files = Storage::disk('uploaders')->allFiles(); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | self::initUploaderWithFiles(); |
| 187 | 187 | |
| 188 | 188 | $response = $this->put($this->testBaseUrl.'/1', [ |
| 189 | - 'upload_multiple' => $this->getUploadedFiles(['avatar4.jpg', 'avatar5.jpg']), |
|
| 189 | + 'upload_multiple' => $this->getUploadedFiles(['avatar4.jpg', 'avatar5.jpg']), |
|
| 190 | 190 | 'clear_upload_multiple' => ['avatar2.jpg'], |
| 191 | 191 | 'id' => 1, |
| 192 | 192 | ]); |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $this->assertDatabaseCount('uploaders', 1); |
| 199 | 199 | |
| 200 | 200 | $this->assertDatabaseHas('uploaders', [ |
| 201 | - 'extras' => json_encode(['upload_multiple' => ['avatar3.jpg', 'avatar4.jpg', 'avatar5.jpg'], 'upload' => 'avatar1.jpg']), |
|
| 201 | + 'extras' => json_encode(['upload_multiple' => ['avatar3.jpg', 'avatar4.jpg', 'avatar5.jpg'], 'upload' => 'avatar1.jpg']), |
|
| 202 | 202 | ]); |
| 203 | 203 | |
| 204 | 204 | $files = Storage::disk('uploaders')->allFiles(); |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | UploadedFile::fake()->image('avatar3.jpg')->storeAs('', 'avatar3.jpg', ['disk' => 'uploaders']); |
| 219 | 219 | |
| 220 | 220 | FakeUploader::create([ |
| 221 | - 'extras' => ['upload' => 'avatar1.jpg','upload_multiple' => ['avatar2.jpg', 'avatar3.jpg']], |
|
| 221 | + 'extras' => ['upload' => 'avatar1.jpg', 'upload_multiple' => ['avatar2.jpg', 'avatar3.jpg']], |
|
| 222 | 222 | ]); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | protected static function initUploader() |
| 226 | 226 | { |
| 227 | 227 | FakeUploader::create([ |
| 228 | - 'extras' => ['upload' => null,'upload_multiple' => null], |
|
| 228 | + 'extras' => ['upload' => null, 'upload_multiple' => null], |
|
| 229 | 229 | ]); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | protected function getUploadedFiles(array $fileNames) |
| 238 | 238 | { |
| 239 | - return array_map(function ($fileName) { |
|
| 239 | + return array_map(function($fileName) { |
|
| 240 | 240 | return new UploadedFile(__DIR__.'/../config/assets/'.$fileName, $fileName, 'image/jpg', null, true); |
| 241 | 241 | }, $fileNames); |
| 242 | 242 | } |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | $this->singleSaveAction = [ |
| 26 | 26 | 'name' => 'save_action_one', |
| 27 | 27 | 'button_text' => 'custom', |
| 28 | - 'redirect' => function ($crud, $request, $itemId) { |
|
| 28 | + 'redirect' => function($crud, $request, $itemId) { |
|
| 29 | 29 | return $crud->route; |
| 30 | 30 | }, |
| 31 | - 'visible' => function ($crud) { |
|
| 31 | + 'visible' => function($crud) { |
|
| 32 | 32 | return true; |
| 33 | 33 | }, |
| 34 | 34 | ]; |
@@ -36,19 +36,19 @@ discard block |
||
| 36 | 36 | $this->multipleSaveActions = [ |
| 37 | 37 | [ |
| 38 | 38 | 'name' => 'save_action_one', |
| 39 | - 'redirect' => function ($crud, $request, $itemId) { |
|
| 39 | + 'redirect' => function($crud, $request, $itemId) { |
|
| 40 | 40 | return $crud->route; |
| 41 | 41 | }, |
| 42 | - 'visible' => function ($crud) { |
|
| 42 | + 'visible' => function($crud) { |
|
| 43 | 43 | return true; |
| 44 | 44 | }, |
| 45 | 45 | ], |
| 46 | 46 | [ |
| 47 | 47 | 'name' => 'save_action_two', |
| 48 | - 'redirect' => function ($crud, $request, $itemId) { |
|
| 48 | + 'redirect' => function($crud, $request, $itemId) { |
|
| 49 | 49 | return $crud->route; |
| 50 | 50 | }, |
| 51 | - 'visible' => function ($crud) { |
|
| 51 | + 'visible' => function($crud) { |
|
| 52 | 52 | return true; |
| 53 | 53 | }, |
| 54 | 54 | ], |