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 — upload-validation ( 199e68...d8ff11 )
by Pedro
11:25
created
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;
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
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
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Validation.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function setValidation($classOrRulesArray = false, $messages = [])
62 62
     {
63
-        if (! $classOrRulesArray) {
63
+        if (!$classOrRulesArray) {
64 64
             $this->setValidationFromFields();
65 65
         } elseif (is_array($classOrRulesArray)) {
66 66
             $this->setValidationFromArray($classOrRulesArray, $messages);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             return $this->checkRequestValidity($extendedRules, $extendedMessages, $formRequest);
140 140
         }
141 141
 
142
-        return ! empty($rules) ? $this->checkRequestValidity($rules, $messages) : $this->getRequest();
142
+        return !empty($rules) ? $this->checkRequestValidity($rules, $messages) : $this->getRequest();
143 143
     }
144 144
 
145 145
     /**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function isRequired($inputKey)
226 226
     {
227
-        if (! $this->hasOperationSetting('requiredFields')) {
227
+        if (!$this->hasOperationSetting('requiredFields')) {
228 228
             return false;
229 229
         }
230 230
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         [$rules, $messages] = $this->getValidationRulesAndMessagesFromField($field, $parent);
247 247
 
248
-        if (! empty($rules)) {
248
+        if (!empty($rules)) {
249 249
             $this->setValidation($rules, $messages);
250 250
         }
251 251
     }
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
     {
261 261
         $messages = [];
262 262
         collect($fields)
263
-            ->filter(function ($value, $key) {
263
+            ->filter(function($value, $key) {
264 264
                 // only keep fields where 'validationMessages' OR there are subfields
265 265
                 return array_key_exists('validationMessages', $value) || array_key_exists('subfields', $value);
266
-            })->each(function ($item, $key) use (&$messages) {
266
+            })->each(function($item, $key) use (&$messages) {
267 267
                 if (isset($item['validationMessages'])) {
268 268
                     foreach ($item['validationMessages'] as $rule => $message) {
269 269
                         $messages[$key.'.'.$rule] = $message;
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                 }
272 272
                 // add messages from subfields
273 273
                 if (array_key_exists('subfields', $item)) {
274
-                    $subfieldsWithValidationMessages = array_filter($item['subfields'], function ($subfield) {
274
+                    $subfieldsWithValidationMessages = array_filter($item['subfields'], function($subfield) {
275 275
                         return array_key_exists('validationRules', $subfield);
276 276
                     });
277 277
 
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
     private function getValidationRulesFromFieldsAndSubfields($fields)
296 296
     {
297 297
         $rules = collect($fields)
298
-            ->filter(function ($value, $key) {
298
+            ->filter(function($value, $key) {
299 299
                 // only keep fields where 'validationRules' OR there are subfields
300 300
                 return array_key_exists('validationRules', $value) || array_key_exists('subfields', $value);
301
-            })->map(function ($item, $key) {
301
+            })->map(function($item, $key) {
302 302
                 $validationRules = [];
303 303
                 // only keep the rules, not the entire field definition
304 304
                 if (isset($item['validationRules'])) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                 }
307 307
                 // add validation rules for subfields
308 308
                 if (array_key_exists('subfields', $item)) {
309
-                    $subfieldsWithValidation = array_filter($item['subfields'], function ($subfield) {
309
+                    $subfieldsWithValidation = array_filter($item['subfields'], function($subfield) {
310 310
                         return array_key_exists('validationRules', $subfield);
311 311
                     });
312 312
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     {
365 365
         $extendedRules = [];
366 366
         $requestRules = $this->getRequestRulesAsArray($request);
367
-        $rules = array_map(function ($ruleDefinition) {
367
+        $rules = array_map(function($ruleDefinition) {
368 368
             return is_array($ruleDefinition) ? $ruleDefinition : explode('|', $ruleDefinition);
369 369
         }, $rules);
370 370
 
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Validation/ValidBackpackUpload.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     public static function make(): self
31 31
     {
32
-        $instance =  new static();
32
+        $instance = new static();
33 33
         $entry = CrudPanelFacade::getCurrentEntry();
34 34
         $instance->entry = $entry !== false ? $entry : null;
35 35
         return $instance;
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
     /**
77 77
      * Set the rules that apply to the "array" aka the field, if it's required, min, max etc.
78 78
      */
79
-    public function arrayRules(string|array|File $rules): self
79
+    public function arrayRules(string | array | File $rules): self
80 80
     {
81 81
         if (is_string($rules)) {
82 82
             $rules = explode('|', $rules);
83 83
         }
84 84
 
85
-        if (! in_array('array', $rules)) {
85
+        if (!in_array('array', $rules)) {
86 86
             $rules[] = 'array';
87 87
         }
88 88
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
     /**
95 95
      * Set the rules that apply to the files beeing uploaded.
96 96
      */
97
-    public function fileRules(string|array|File $rules): self
97
+    public function fileRules(string | array | File $rules): self
98 98
     {
99 99
         if (is_string($rules)) {
100 100
             $rules = explode('|', $rules);
101 101
         }
102
-        if (! is_array($rules)) {
102
+        if (!is_array($rules)) {
103 103
             $rules = [$rules];
104 104
         }
105 105
         $this->fileRules = $rules;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     protected function validateFiles($attribute, $files, $fail)
119 119
     {
120 120
         foreach ($files as $file) {
121
-            if(!is_file($file)) {
121
+            if (!is_file($file)) {
122 122
                 continue;
123 123
             }
124 124
             $validator = Validator::make([$attribute => $file], [
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             ], $this->validator->customMessages, $this->validator->customAttributes);
127 127
 
128 128
             if ($validator->fails()) {
129
-                foreach($validator->errors()->messages()[$attribute] as $message) {
129
+                foreach ($validator->errors()->messages()[$attribute] as $message) {
130 130
                     $fail($message);
131 131
                 };
132 132
             }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         ], $this->validator->customMessages, $this->validator->customAttributes);
151 151
 
152 152
         if ($validator->fails()) {
153
-            foreach($validator->errors()->messages()[$attribute] as $message) {
153
+            foreach ($validator->errors()->messages()[$attribute] as $message) {
154 154
                 $fail($message);
155 155
             };
156 156
         }
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Validation/ValidUploadMultiple.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function validate(string $attribute, mixed $value, Closure $fail): void
19 19
     {
20
-        if (! is_array($value)) {
20
+        if (!is_array($value)) {
21 21
             try {
22 22
                 $value = json_decode($value, true);
23
-            } catch(\Exception $e) {
23
+            } catch (\Exception $e) {
24 24
                 $fail('Unable to determine the value type');
25 25
 
26 26
                 return;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $value = array_merge($previousValues, $value);
43 43
 
44 44
         // if user uploaded something add it to the data beeing validated.
45
-        if(!empty($value)) {
45
+        if (!empty($value)) {
46 46
             $this->data[$attribute] = $value;
47 47
         }
48 48
        
Please login to merge, or discard this patch.