Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Push — crud-uploads ( 6e8179...79720b )
by Pedro
15:18
created
src/app/Library/Uploaders/MultipleFiles.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Uploader.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/app/Library/Uploaders/SingleFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Support/RegisterUploadEvents.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
     private string $crudObjectType;
14 14
 
15 15
     public function __construct(
16
-        private readonly CrudField|CrudColumn $crudObject,
16
+        private readonly CrudField | CrudColumn $crudObject,
17 17
         private readonly array $uploaderConfiguration,
18 18
         private readonly string $macro
19 19
         ) {
20 20
         $this->crudObjectType = is_a($crudObject, CrudField::class) ? 'field' : (is_a($crudObject, CrudColumn::class) ? 'column' : null);
21 21
 
22
-        if (! $this->crudObjectType) {
22
+        if (!$this->crudObjectType) {
23 23
             abort(500, 'Upload handlers only work for CrudField and CrudColumn classes.');
24 24
         }
25 25
     }
26 26
 
27
-    public static function handle(CrudField|CrudColumn $crudObject, array $uploaderConfiguration, string $macro, ?array $subfield = null): void
27
+    public static function handle(CrudField | CrudColumn $crudObject, array $uploaderConfiguration, string $macro, ?array $subfield = null): void
28 28
     {
29 29
         $instance = new self($crudObject, $uploaderConfiguration, $macro);
30 30
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
     /*******************************
35 35
      * Private methods - implementation
36 36
      *******************************/
37
-    private function registerEvents(array|null $subfield = []): void
37
+    private function registerEvents(array | null $subfield = []): void
38 38
     {
39
-        if (! empty($subfield)) {
39
+        if (!empty($subfield)) {
40 40
             $this->registerSubfieldEvent($subfield);
41 41
 
42 42
             return;
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 
72 72
         // for subfields, we only register one event so that we have access to the repeatable container name.
73 73
         // all the uploaders for a given container are stored in the UploadersRepository.
74
-        if (! app('UploadersRepository')->hasRepeatableUploadersFor($uploader->getRepeatableContainerName())) {
74
+        if (!app('UploadersRepository')->hasRepeatableUploadersFor($uploader->getRepeatableContainerName())) {
75 75
             $this->setupModelEvents($model, $uploader);
76 76
         }
77 77
 
78 78
         $subfields = collect($this->crudObject->getAttributes()['subfields']);
79
-        $subfields = $subfields->map(function ($item) use ($subfield, $uploader) {
79
+        $subfields = $subfields->map(function($item) use ($subfield, $uploader) {
80 80
             if ($item['name'] === $subfield['name']) {
81 81
                 $item['upload'] = true;
82 82
                 $item['disk'] = $uploader->getDisk();
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         }
107 107
 
108 108
         if ($this->crudObjectType === 'field') {
109
-            $model::saving(function ($entry) use ($uploader) {
109
+            $model::saving(function($entry) use ($uploader) {
110 110
                 $updatedCountKey = 'uploaded_'.($uploader->getRepeatableContainerName() ?? $uploader->getName()).'_count';
111 111
 
112 112
                 CRUD::set($updatedCountKey, CRUD::get($updatedCountKey) ?? 0);
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
             });
118 118
         }
119 119
 
120
-        $model::retrieved(function ($entry) use ($uploader) {
120
+        $model::retrieved(function($entry) use ($uploader) {
121 121
             $entry = $uploader->retrieveUploadedFiles($entry);
122 122
         });
123 123
 
124
-        $model::deleting(function ($entry) use ($uploader) {
124
+        $model::deleting(function($entry) use ($uploader) {
125 125
             $uploader->deleteUploadedFiles($entry);
126 126
         });
127 127
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
         $customUploader = isset($uploaderConfiguration['uploader']) && class_exists($uploaderConfiguration['uploader']);
145 145
 
146 146
         if ($customUploader) {
147
-            return $uploaderConfiguration['uploader']::for($crudObject, $uploaderConfiguration);
147
+            return $uploaderConfiguration['uploader']::for ($crudObject, $uploaderConfiguration);
148 148
         }
149 149
 
150 150
         $uploader = app('UploadersRepository')->hasUploadFor($crudObject['type'], $this->macro);
151 151
 
152 152
         if ($uploader) {
153
-            return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for($crudObject, $uploaderConfiguration);
153
+            return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for ($crudObject, $uploaderConfiguration);
154 154
         }
155 155
 
156 156
         throw new Exception('Undefined upload type for '.$this->crudObjectType.' type: '.$crudObject['type']);
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Support/Traits/HandleFileNaming.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Support/Traits/HandleRepeatableUploads.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $uploader) {
77 77
             $uploadedValues = $uploader->uploadRepeatableFiles($entry, $value->pluck($uploader->getName())->toArray(), $this->getPreviousRepeatableValues($entry, $uploader));
78 78
 
79
-            $value = $value->map(function ($item, $key) use ($uploadedValues, $uploader) {
79
+            $value = $value->map(function($item, $key) use ($uploadedValues, $uploader) {
80 80
                 $item[$uploader->getName()] = $uploadedValues[$key] ?? null;
81 81
 
82 82
                 return $item;
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 
106 106
         $repeatableValues = collect($entry->{$this->getName()});
107 107
         foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $upload) {
108
-            if (! $upload->shouldDeleteFiles()) {
108
+            if (!$upload->shouldDeleteFiles()) {
109 109
                 continue;
110 110
             }
111 111
             $values = $repeatableValues->pluck($upload->getName())->toArray();
112 112
             foreach ($values as $value) {
113 113
 
114
-                if (! $value) { continue; }
114
+                if (!$value) { continue; }
115 115
 
116 116
                 if (is_array($value)) {
117 117
                     foreach ($value as $subvalue) {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     /**
132 132
      * Given two multidimensional arrays/collections, merge them recursively.
133 133
      */
134
-    private function mergeValuesRecursive(array|Collection $array1,array|Collection $array2): array|Collection
134
+    private function mergeValuesRecursive(array | Collection $array1, array | Collection $array2): array | Collection
135 135
     {
136 136
         $merged = $array1;
137 137
         foreach ($array2 as $key => &$value) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     {
154 154
         $items = CRUD::getRequest()->input('_order_'.$this->getRepeatableContainerName()) ?? [];
155 155
 
156
-        array_walk($items, function (&$key, $value) {
156
+        array_walk($items, function(&$key, $value) {
157 157
             $requestValue = $key[$this->getName()] ?? null;
158 158
             $key = $this->handleMultipleFiles ? (is_string($requestValue) ? explode(',', $requestValue) : $requestValue) : $requestValue;
159 159
         });
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $previousValues = json_decode($entry->getOriginal($uploader->getRepeatableContainerName()), true);
167 167
        
168
-        if (! empty($previousValues)) {
168
+        if (!empty($previousValues)) {
169 169
             $previousValues = array_column($previousValues, $uploader->getName());
170 170
         }
171 171
 
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Support/FileNameGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,17 +8,17 @@
 block discarded – undo
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));
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Support/Interfaces/FileNameGeneratorInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Support/Interfaces/UploaderInterface.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 use Illuminate\Http\UploadedFile;
7 7
 
8 8
 interface UploaderInterface
9
- {
9
+    {
10 10
     /**
11 11
      * Static constructor function
12 12
      */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * Static constructor function
12 12
      */
13
-    public static function for(array $field, array $configuration): UploaderInterface;
13
+    public static function for (array $field, array $configuration): UploaderInterface;
14 14
 
15 15
     /**
16 16
      * Default implementation functions
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public function getPath(): string;
35 35
     public function useTemporaryUrl(): bool;
36 36
     public function getExpirationTimeInMinutes(): int;
37
-    public function getFileName(string|UploadedFile $file): string;
37
+    public function getFileName(string | UploadedFile $file): string;
38 38
     public function getRepeatableContainerName(): ?string;
39 39
     public function getIdentifier(): string;
40 40
     public function shouldDeleteFiles(): bool;
Please login to merge, or discard this patch.