We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -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 = ''; |
@@ -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 | } |
@@ -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; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | class MultipleFiles extends Uploader |
12 | 12 | { |
13 | - public static function for(array $field, $configuration): UploaderInterface |
|
13 | + public static function for (array $field, $configuration): UploaderInterface |
|
14 | 14 | { |
15 | 15 | return (new self($field, $configuration))->multiple(); |
16 | 16 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $value = $value ?? CRUD::getRequest()->file($this->getName()); |
22 | 22 | $previousFiles = $entry->getOriginal($this->getName()) ?? []; |
23 | 23 | |
24 | - if (! is_array($previousFiles) && is_string($previousFiles)) { |
|
24 | + if (!is_array($previousFiles) && is_string($previousFiles)) { |
|
25 | 25 | $previousFiles = json_decode($previousFiles, true); |
26 | 26 | } |
27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | if (in_array($previousFile, $filesToDelete)) { |
31 | 31 | Storage::disk($this->getDisk())->delete($previousFile); |
32 | 32 | |
33 | - $previousFiles = Arr::where($previousFiles, function ($value, $key) use ($previousFile) { |
|
33 | + $previousFiles = Arr::where($previousFiles, function($value, $key) use ($previousFile) { |
|
34 | 34 | return $value != $previousFile; |
35 | 35 | }); |
36 | 36 | } |
@@ -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; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $value = $entry->{$this->name}; |
171 | 171 | |
172 | - if ($this->handleMultipleFiles && ! isset($entry->getCasts()[$this->name]) && is_string($value)) { |
|
172 | + if ($this->handleMultipleFiles && !isset($entry->getCasts()[$this->name]) && is_string($value)) { |
|
173 | 173 | $entry->{$this->name} = json_decode($value, true); |
174 | 174 | |
175 | 175 | return $entry; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | if ($this->handleMultipleFiles) { |
188 | 188 | // ensure we have an array of values when field is not casted in model. |
189 | - if (! isset($entry->getCasts()[$this->name]) && is_string($values)) { |
|
189 | + if (!isset($entry->getCasts()[$this->name]) && is_string($values)) { |
|
190 | 190 | $values = json_decode($values, true); |
191 | 191 | } |
192 | 192 | foreach ($values as $value) { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | private function performFileDeletion(Model $entry) |
204 | 204 | { |
205 | - if ($this->isRelationship || ! $this->handleRepeatableFiles) { |
|
205 | + if ($this->isRelationship || !$this->handleRepeatableFiles) { |
|
206 | 206 | $this->deleteFiles($entry); |
207 | 207 | |
208 | 208 | return; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | return $this->getPath().$fileName; |
24 | 24 | } |
25 | 25 | |
26 | - if (! $value && CrudPanelFacade::getRequest()->has($this->getName()) && $previousFile) { |
|
26 | + if (!$value && CrudPanelFacade::getRequest()->has($this->getName()) && $previousFile) { |
|
27 | 27 | Storage::disk($this->getDisk())->delete($previousFile); |
28 | 28 | |
29 | 29 | return null; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | foreach ($previousRepeatableValues as $row => $file) { |
50 | - if ($file && ! isset($orderedFiles[$row])) { |
|
50 | + if ($file && !isset($orderedFiles[$row])) { |
|
51 | 51 | $orderedFiles[$row] = null; |
52 | 52 | Storage::disk($this->getDisk())->delete($file); |
53 | 53 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | public FileNameGeneratorInterface $fileNameGenerator; |
13 | 13 | |
14 | - public function getFileName(string|UploadedFile $file): string |
|
14 | + public function getFileName(string | UploadedFile $file): string |
|
15 | 15 | { |
16 | 16 | if ($this->fileName) { |
17 | 17 | return is_callable($this->fileName) ? ($this->fileName)($file, $this) : $this->fileName; |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | { |
25 | 25 | $fileGeneratorClass = $fileNameGenerator ?? config('backpack.crud.file_name_generator'); |
26 | 26 | |
27 | - if (! class_exists($fileGeneratorClass)) { |
|
27 | + if (!class_exists($fileGeneratorClass)) { |
|
28 | 28 | throw new \Exception("The file name generator class [{$fileGeneratorClass}] does not exist."); |
29 | 29 | } |
30 | 30 | |
31 | - if (! in_array(FileNameGeneratorInterface::class, class_implements($fileGeneratorClass, false))) { |
|
31 | + if (!in_array(FileNameGeneratorInterface::class, class_implements($fileGeneratorClass, false))) { |
|
32 | 32 | throw new \Exception("The file name generator class [{$fileGeneratorClass}] must implement the [".FileNameGeneratorInterface::class.'] interface.'); |
33 | 33 | } |
34 | 34 |
@@ -8,17 +8,17 @@ |
||
8 | 8 | |
9 | 9 | class FileNameGenerator implements FileNameGeneratorInterface |
10 | 10 | { |
11 | - public function getName(string|UploadedFile $file): string |
|
11 | + public function getName(string | UploadedFile $file): string |
|
12 | 12 | { |
13 | 13 | return $this->getFileName($file).'.'.$this->getExtensionFromFile($file); |
14 | 14 | } |
15 | 15 | |
16 | - private function getExtensionFromFile(string|UploadedFile $file): string |
|
16 | + private function getExtensionFromFile(string | UploadedFile $file): string |
|
17 | 17 | { |
18 | 18 | return is_a($file, UploadedFile::class, true) ? $file->extension() : Str::after(mime_content_type($file), '/'); |
19 | 19 | } |
20 | 20 | |
21 | - private function getFileName(string|UploadedFile $file): string |
|
21 | + private function getFileName(string | UploadedFile $file): string |
|
22 | 22 | { |
23 | 23 | if (is_file($file)) { |
24 | 24 | return Str::of($file->getClientOriginalName())->beforeLast('.')->slug()->append('-'.Str::random(4)); |
@@ -6,5 +6,5 @@ |
||
6 | 6 | |
7 | 7 | interface FileNameGeneratorInterface |
8 | 8 | { |
9 | - public function getName(string|UploadedFile $file): string; |
|
9 | + public function getName(string | UploadedFile $file): string; |
|
10 | 10 | } |