We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public FileNameGeneratorInterface $fileNameGenerator; |
| 14 | 14 | |
| 15 | - public function getFileName(string|UploadedFile|File $file): string |
|
| 15 | + public function getFileName(string | UploadedFile | File $file): string |
|
| 16 | 16 | { |
| 17 | 17 | if ($this->fileName) { |
| 18 | 18 | return is_callable($this->fileName) ? ($this->fileName)($file, $this) : $this->fileName; |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | $fileGeneratorClass = $fileNameGenerator ?? config('backpack.crud.file_name_generator'); |
| 27 | 27 | |
| 28 | - if (! class_exists($fileGeneratorClass)) { |
|
| 28 | + if (!class_exists($fileGeneratorClass)) { |
|
| 29 | 29 | throw new \Exception("The file name generator class [{$fileGeneratorClass}] does not exist."); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if (! in_array(FileNameGeneratorInterface::class, class_implements($fileGeneratorClass, false))) { |
|
| 32 | + if (!in_array(FileNameGeneratorInterface::class, class_implements($fileGeneratorClass, false))) { |
|
| 33 | 33 | throw new \Exception("The file name generator class [{$fileGeneratorClass}] must implement the [".FileNameGeneratorInterface::class.'] interface.'); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | /******************************* |
| 57 | 57 | * Static methods |
| 58 | 58 | *******************************/ |
| 59 | - public static function for(array $crudObject, array $definition): UploaderInterface |
|
| 59 | + public static function for (array $crudObject, array $definition): UploaderInterface |
|
| 60 | 60 | { |
| 61 | 61 | return new static($crudObject, $definition); |
| 62 | 62 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function deleteUploadedFiles(Model $entry): void |
| 88 | 88 | { |
| 89 | 89 | if ($this->deleteWhenEntryIsDeleted) { |
| 90 | - if (! in_array(SoftDeletes::class, class_uses_recursive($entry), true)) { |
|
| 90 | + if (!in_array(SoftDeletes::class, class_uses_recursive($entry), true)) { |
|
| 91 | 91 | $this->performFileDeletion($entry); |
| 92 | 92 | |
| 93 | 93 | return; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $value = $entry->{$this->name}; |
| 176 | 176 | |
| 177 | 177 | if ($this->handleMultipleFiles) { |
| 178 | - if (! isset($entry->getCasts()[$this->name]) && is_string($value)) { |
|
| 178 | + if (!isset($entry->getCasts()[$this->name]) && is_string($value)) { |
|
| 179 | 179 | $entry->{$this->name} = json_decode($value, true); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | if ($this->handleMultipleFiles) { |
| 195 | 195 | // ensure we have an array of values when field is not casted in model. |
| 196 | - if (! isset($entry->getCasts()[$this->name]) && is_string($values)) { |
|
| 196 | + if (!isset($entry->getCasts()[$this->name]) && is_string($values)) { |
|
| 197 | 197 | $values = json_decode($values, true); |
| 198 | 198 | } |
| 199 | 199 | foreach ($values as $value) { |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | private function performFileDeletion(Model $entry) |
| 211 | 211 | { |
| 212 | - if ($this->isRelationship || ! $this->handleRepeatableFiles) { |
|
| 212 | + if ($this->isRelationship || !$this->handleRepeatableFiles) { |
|
| 213 | 213 | $this->deleteFiles($entry); |
| 214 | 214 | |
| 215 | 215 | return; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class FileNameGenerator implements FileNameGeneratorInterface |
| 11 | 11 | { |
| 12 | - public function getName(string|UploadedFile|File $file): string |
|
| 12 | + public function getName(string | UploadedFile | File $file): string |
|
| 13 | 13 | { |
| 14 | 14 | if (is_object($file) && get_class($file) === File::class) { |
| 15 | 15 | return $file->getFileName(); |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | return $this->getFileName($file).'.'.$this->getExtensionFromFile($file); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - private function getExtensionFromFile(string|UploadedFile $file): string |
|
| 21 | + private function getExtensionFromFile(string | UploadedFile $file): string |
|
| 22 | 22 | { |
| 23 | 23 | return is_a($file, UploadedFile::class, true) ? $file->extension() : Str::after(mime_content_type($file), '/'); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - private function getFileName(string|UploadedFile $file): string |
|
| 26 | + private function getFileName(string | UploadedFile $file): string |
|
| 27 | 27 | { |
| 28 | 28 | if (is_file($file)) { |
| 29 | 29 | return Str::of($file->getClientOriginalName())->beforeLast('.')->slug()->append('-'.Str::random(4)); |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function validate(string $attribute, mixed $value, Closure $fail): void |
| 20 | 20 | { |
| 21 | - if (! is_array($value)) { |
|
| 21 | + if (!is_array($value)) { |
|
| 22 | 22 | try { |
| 23 | 23 | $value = json_decode($value, true); |
| 24 | - } catch(\Exception $e) { |
|
| 24 | + } catch (\Exception $e) { |
|
| 25 | 25 | $fail('Unable to determine the value type'); |
| 26 | 26 | |
| 27 | 27 | return; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $filesToClear = CrudPanelFacade::getRequest()->input('clear_'.$attribute) ?? []; |
| 34 | 34 | $previousFiles = CrudPanelFacade::getCurrentEntry()->{$attribute} ?? []; |
| 35 | 35 | |
| 36 | - if (is_string($previousFiles) && ! isset(CrudPanelFacade::getCurrentEntry()->getCasts()[$attribute])) { |
|
| 36 | + if (is_string($previousFiles) && !isset(CrudPanelFacade::getCurrentEntry()->getCasts()[$attribute])) { |
|
| 37 | 37 | $previousFiles = json_decode($previousFiles, true); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function arrayRules(string|array|File $rules): self |
|
| 41 | + public function arrayRules(string | array | File $rules): self |
|
| 42 | 42 | { |
| 43 | 43 | if (is_string($rules)) { |
| 44 | 44 | $rules = explode('|', $rules); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if (! in_array('array', $rules)) { |
|
| 47 | + if (!in_array('array', $rules)) { |
|
| 48 | 48 | $rules[] = 'array'; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | return $this; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function fileRules(string|array|File $rules): self |
|
| 56 | + public function fileRules(string | array | File $rules): self |
|
| 57 | 57 | { |
| 58 | 58 | if (is_string($rules)) { |
| 59 | 59 | $rules = explode('|', $rules); |
| 60 | 60 | } |
| 61 | - if (! is_array($rules)) { |
|
| 61 | + if (!is_array($rules)) { |
|
| 62 | 62 | $rules = [$rules]; |
| 63 | 63 | } |
| 64 | 64 | $this->fileRules = $rules; |