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

Test Failed
Push — fix-uploaders ( f40977...29279d )
by Pedro
13:54
created
src/app/Console/Commands/Themes/InstallsTheme.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         }
72 72
 
73 73
         // Display general error in case it failed
74
-        if (! $this->isInstalled()) {
74
+        if (!$this->isInstalled()) {
75 75
             $this->errorProgressBlock();
76 76
             $this->note('For further information please check the log file.');
77 77
             $this->note('You can also follow the manual installation process documented on GitHub.');
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $this->progressBlock('Publish theme config file');
85 85
 
86 86
         // manually include the provider in the run-time
87
-        if (! class_exists(self::$addon['provider'])) {
87
+        if (!class_exists(self::$addon['provider'])) {
88 88
             include self::$addon['provider_path'] ?? self::$addon['path'].'/src/AddonServiceProvider.php';
89 89
             app()->register(self::$addon['provider']);
90 90
         }
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/CrudPanel.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function setModel($model_namespace)
111 111
     {
112
-        if (! class_exists($model_namespace)) {
112
+        if (!class_exists($model_namespace)) {
113 113
             throw new \Exception('The model does not exist.', 500);
114 114
         }
115 115
 
116
-        if (! method_exists($model_namespace, 'hasCrudTrait')) {
116
+        if (!method_exists($model_namespace, 'hasCrudTrait')) {
117 117
             throw new \Exception('Please use CrudTrait on the model.', 500);
118 118
         }
119 119
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
         $complete_route = $route.'.index';
208 208
 
209
-        if (! \Route::has($complete_route)) {
209
+        if (!\Route::has($complete_route)) {
210 210
             throw new \Exception('There are no routes for this route name.', 404);
211 211
         }
212 212
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      */
305 305
     public function getFirstOfItsTypeInArray($type, $array)
306 306
     {
307
-        return Arr::first($array, function ($item) use ($type) {
307
+        return Arr::first($array, function($item) use ($type) {
308 308
             return $item['type'] == $type;
309 309
         });
310 310
     }
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function sync($type, $fields, $attributes)
326 326
     {
327
-        if (! empty($this->{$type})) {
328
-            $this->{$type} = array_map(function ($field) use ($fields, $attributes) {
327
+        if (!empty($this->{$type})) {
328
+            $this->{$type} = array_map(function($field) use ($fields, $attributes) {
329 329
                 if (in_array($field['name'], (array) $fields)) {
330 330
                     $field = array_merge($field, $attributes);
331 331
                 }
@@ -355,15 +355,15 @@  discard block
 block discarded – undo
355 355
     {
356 356
         $relationArray = explode('.', $relationString);
357 357
 
358
-        if (! isset($length)) {
358
+        if (!isset($length)) {
359 359
             $length = count($relationArray);
360 360
         }
361 361
 
362
-        if (! isset($model)) {
362
+        if (!isset($model)) {
363 363
             $model = $this->model;
364 364
         }
365 365
 
366
-        $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) {
366
+        $result = array_reduce(array_splice($relationArray, 0, $length), function($obj, $method) {
367 367
             try {
368 368
                 $result = $obj->$method();
369 369
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
             if (is_array($entries)) {
399 399
                 //if attribute does not exist in main array we have more than one entry OR the attribute
400 400
                 //is an accessor that is not in $appends property of model.
401
-                if (! isset($entries[$attribute])) {
401
+                if (!isset($entries[$attribute])) {
402 402
                     //we first check if we don't have the attribute because it's an accessor that is not in appends.
403 403
                     if ($model_instance->hasGetMutator($attribute) && isset($entries[$modelKey])) {
404 404
                         $entry_in_database = $model_instance->find($entries[$modelKey]);
@@ -437,21 +437,21 @@  discard block
 block discarded – undo
437 437
      */
438 438
     public function parseTranslatableAttributes($model, $attribute, $value)
439 439
     {
440
-        if (! method_exists($model, 'isTranslatableAttribute')) {
440
+        if (!method_exists($model, 'isTranslatableAttribute')) {
441 441
             return $value;
442 442
         }
443 443
 
444
-        if (! $model->isTranslatableAttribute($attribute)) {
444
+        if (!$model->isTranslatableAttribute($attribute)) {
445 445
             return $value;
446 446
         }
447 447
 
448
-        if (! is_array($value)) {
448
+        if (!is_array($value)) {
449 449
             $decodedAttribute = json_decode($value, true);
450 450
         } else {
451 451
             $decodedAttribute = $value;
452 452
         }
453 453
 
454
-        if (is_array($decodedAttribute) && ! empty($decodedAttribute)) {
454
+        if (is_array($decodedAttribute) && !empty($decodedAttribute)) {
455 455
             if (isset($decodedAttribute[app()->getLocale()])) {
456 456
                 return $decodedAttribute[app()->getLocale()];
457 457
             } else {
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         $relation = $model->{$firstRelationName};
478 478
 
479 479
         $results = [];
480
-        if (! is_null($relation)) {
480
+        if (!is_null($relation)) {
481 481
             if ($relation instanceof Collection) {
482 482
                 $currentResults = $relation->all();
483 483
             } elseif (is_array($relation)) {
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
             array_shift($relationArray);
492 492
 
493
-            if (! empty($relationArray)) {
493
+            if (!empty($relationArray)) {
494 494
                 foreach ($currentResults as $currentResult) {
495 495
                     $results = array_merge_recursive($results, $this->getRelatedEntries($currentResult, implode('.', $relationArray)));
496 496
                 }
Please login to merge, or discard this patch.
config/database/migrations/2024_02_15_125654_create_uploaders_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public function up(): void
13 13
     {
14
-        Schema::create('uploaders', function (Blueprint $table) {
14
+        Schema::create('uploaders', function(Blueprint $table) {
15 15
             $table->bigIncrements('id')->unsigned();
16 16
             $table->string('upload')->nullable();
17 17
             $table->string('image')->nullable();
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Support/Traits/HandleRepeatableUploads.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 {
19 19
     public bool $handleRepeatableFiles = false;
20 20
 
21
-    public null|string $repeatableContainerName = null;
21
+    public null | string $repeatableContainerName = null;
22 22
 
23 23
     /*******************************
24 24
      * Setters - fluently configure the uploader
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     /*******************************
36 36
      * Getters
37 37
      *******************************/
38
-    public function getRepeatableContainerName(): null|string
38
+    public function getRepeatableContainerName(): null | string
39 39
     {
40 40
         return $this->repeatableContainerName;
41 41
     }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $uploader) {
164 164
             $uploadedValues = $uploader->uploadRepeatableFiles($values->pluck($uploader->getAttributeName())->toArray(), $this->getPreviousRepeatableValues($entry, $uploader));
165 165
 
166
-            $values = $values->map(function ($item, $key) use ($uploadedValues, $uploader) {
166
+            $values = $values->map(function($item, $key) use ($uploadedValues, $uploader) {
167 167
                 $item[$uploader->getAttributeName()] = $uploadedValues[$key] ?? null;
168 168
 
169 169
                 return $item;
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
         $values = $entry->{$this->getRepeatableContainerName()};
196 196
         $values = is_string($values) ? json_decode($values, true) : $values;
197
-        $values = array_map(function ($item) use ($repeatableUploaders) {
197
+        $values = array_map(function($item) use ($repeatableUploaders) {
198 198
             foreach ($repeatableUploaders as $upload) {
199 199
                 $item[$upload->getAttributeName()] = $this->getValuesWithPathStripped($item, $upload);
200 200
             }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
     private function retrieveRepeatableRelationFiles(Model $entry)
211 211
     {
212
-        switch($this->getRepeatableRelationType()) {
212
+        switch ($this->getRepeatableRelationType()) {
213 213
             case 'BelongsToMany':
214 214
             case 'MorphToMany':
215 215
                 $pivotClass = app('crud')->getModel()->{$this->getUploaderSubfield()['baseEntity']}()->getPivotClass();
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
         $repeatableValues ??= collect($entry->{$this->getRepeatableContainerName()});
263 263
 
264 264
         foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $upload) {
265
-            if (! $upload->shouldDeleteFiles()) {
265
+            if (!$upload->shouldDeleteFiles()) {
266 266
                 continue;
267 267
             }
268 268
             $values = $repeatableValues->pluck($upload->getName())->toArray();
269 269
             foreach ($values as $value) {
270
-                if (! $value) {
270
+                if (!$value) {
271 271
                     continue;
272 272
                 }
273 273
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     /**
291 291
      * Given two multidimensional arrays/collections, merge them recursively.
292 292
      */
293
-    protected function mergeValuesRecursive(array|Collection $array1, array|Collection $array2): array|Collection
293
+    protected function mergeValuesRecursive(array | Collection $array1, array | Collection $array2): array | Collection
294 294
     {
295 295
         $merged = $array1;
296 296
         foreach ($array2 as $key => &$value) {
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     {
313 313
         $items = CRUD::getRequest()->input('_order_'.$this->getRepeatableContainerName()) ?? [];
314 314
 
315
-        array_walk($items, function (&$key, $value) {
315
+        array_walk($items, function(&$key, $value) {
316 316
             $requestValue = $key[$this->getName()] ?? null;
317 317
             $key = $this->handleMultipleFiles ? (is_string($requestValue) ? explode(',', $requestValue) : $requestValue) : $requestValue;
318 318
         });
@@ -324,22 +324,22 @@  discard block
 block discarded – undo
324 324
     {
325 325
         $previousValues = $entry->getOriginal($uploader->getRepeatableContainerName());
326 326
 
327
-        if (! is_array($previousValues)) {
327
+        if (!is_array($previousValues)) {
328 328
             $previousValues = json_decode($previousValues, true);
329 329
         }
330 330
 
331
-        if (! empty($previousValues)) {
331
+        if (!empty($previousValues)) {
332 332
             $previousValues = array_column($previousValues, $uploader->getName());
333 333
         }
334 334
 
335 335
         return $previousValues ?? [];
336 336
     }
337 337
 
338
-    private function getValuesWithPathStripped(array|string|null $item, UploaderInterface $uploader)
338
+    private function getValuesWithPathStripped(array | string | null $item, UploaderInterface $uploader)
339 339
     {
340 340
         $uploadedValues = $item[$uploader->getName()] ?? null;
341 341
         if (is_array($uploadedValues)) {
342
-            return array_map(function ($value) use ($uploader) {
342
+            return array_map(function($value) use ($uploader) {
343 343
                 return $uploader->getValueWithoutPath($value);
344 344
             }, $uploadedValues);
345 345
         }
@@ -349,12 +349,12 @@  discard block
 block discarded – undo
349 349
 
350 350
     private function deleteRelationshipFiles(Model $entry): void
351 351
     {
352
-        if(!is_a($entry, Pivot::class, true)) {
352
+        if (!is_a($entry, Pivot::class, true)) {
353 353
             $entry->loadMissing($this->getRepeatableContainerName());
354 354
         }
355 355
         
356 356
         foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $uploader) {
357
-            if($uploader->shouldDeleteFiles()) {
357
+            if ($uploader->shouldDeleteFiles()) {
358 358
                 $uploader->deleteRepeatableRelationFiles($entry);
359 359
             }
360 360
         }
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
     private function deleteRepeatableRelationFiles(Model $entry)
364 364
     {
365 365
         if (in_array($this->getRepeatableRelationType(), ['BelongsToMany', 'MorphToMany'])) {
366
-            if(!is_a($entry, Pivot::class, true)) {
366
+            if (!is_a($entry, Pivot::class, true)) {
367 367
                 $pivots = $entry->{$this->getRepeatableContainerName()};
368 368
                 foreach ($pivots as $pivot) {
369 369
                     $this->deletePivotModelFiles($pivot);
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
             }
373 373
 
374 374
             $pivotAttributes = $entry->getAttributes();
375
-            $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function ($item) use ($pivotAttributes) {
375
+            $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function($item) use ($pivotAttributes) {
376 376
                 $itemPivotAttributes = $item->pivot->only(array_keys($pivotAttributes));
377 377
 
378 378
                 return $itemPivotAttributes === $pivotAttributes;
379 379
             })->first();
380 380
 
381
-            if (! $connectedPivot) {
381
+            if (!$connectedPivot) {
382 382
                 return;
383 383
             }
384 384
 
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
         $this->deleteFiles($entry);
389 389
     }
390 390
 
391
-    private function deletePivotModelFiles(Pivot|Model $entry)
391
+    private function deletePivotModelFiles(Pivot | Model $entry)
392 392
     {
393 393
         $files = $entry->getOriginal()['pivot_'.$this->getAttributeName()];
394 394
 
395
-        if (! $files) {
395
+        if (!$files) {
396 396
             return;
397 397
         }
398 398
 
Please login to merge, or discard this patch.