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
Pull Request — main (#4988)
by Cristian
35:23 queued 23:31
created
src/BackpackServiceProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
         include_once __DIR__.'/macros.php';
67 67
 
68 68
         // Bind the CrudPanel object to Laravel's service container
69
-        $this->app->scoped('crud', function ($app) {
69
+        $this->app->scoped('crud', function($app) {
70 70
             return new CrudPanel();
71 71
         });
72 72
 
73
-        $this->app->scoped('DatabaseSchema', function ($app) {
73
+        $this->app->scoped('DatabaseSchema', function($app) {
74 74
             return new DatabaseSchema();
75 75
         });
76 76
 
77
-        $this->app->singleton('BackpackViewNamespaces', function ($app) {
77
+        $this->app->singleton('BackpackViewNamespaces', function($app) {
78 78
             return new ViewNamespaces();
79 79
         });
80 80
 
81 81
         // Bind the widgets collection object to Laravel's service container
82
-        $this->app->singleton('widgets', function ($app) {
82
+        $this->app->singleton('widgets', function($app) {
83 83
             return new Collection();
84 84
         });
85 85
 
86
-        $this->app->scoped('UploadersRepository', function ($app) {
86
+        $this->app->scoped('UploadersRepository', function($app) {
87 87
             return new UploadersRepository();
88 88
         });
89 89
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $middleware_key = config('backpack.base.middleware_key');
100 100
         $middleware_class = config('backpack.base.middleware_class');
101 101
 
102
-        if (! is_array($middleware_class)) {
102
+        if (!is_array($middleware_class)) {
103 103
             $router->pushMiddlewareToGroup($middleware_key, $middleware_class);
104 104
 
105 105
             return;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $operationConfigs = scandir(__DIR__.'/config/backpack/operations/');
216 216
         $operationConfigs = array_diff($operationConfigs, ['.', '..']);
217 217
 
218
-        if (! count($operationConfigs)) {
218
+        if (!count($operationConfigs)) {
219 219
             return;
220 220
         }
221 221
 
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Uploads/Uploaders/MultipleFiles.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 MultipleFiles extends Uploader
11 11
 {
12
-    public static function for(array $field, $configuration)
12
+    public static function for (array $field, $configuration)
13 13
     {
14 14
         return (new self($field, $configuration))->multiple();
15 15
     }
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
         $previousFiles = $entry->getOriginal($this->name) ?? [];
24 24
 
25
-        if (! is_array($previousFiles) && is_string($previousFiles)) {
25
+        if (!is_array($previousFiles) && is_string($previousFiles)) {
26 26
             $previousFiles = json_decode($previousFiles, true);
27 27
         }
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
                 if (in_array($previousFile, $filesToDelete)) {
32 32
                     Storage::disk($this->disk)->delete($previousFile);
33 33
 
34
-                    $previousFiles = Arr::where($previousFiles, function ($value, $key) use ($previousFile) {
34
+                    $previousFiles = Arr::where($previousFiles, function($value, $key) use ($previousFile) {
35 35
                         return $value != $previousFile;
36 36
                     });
37 37
                 }
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Uploads/Uploaders/SingleFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         }
27 27
 
28 28
         foreach ($previousFiles as $row => $file) {
29
-            if ($file && ! isset($orderedFiles[$row])) {
29
+            if ($file && !isset($orderedFiles[$row])) {
30 30
                 $orderedFiles[$row] = null;
31 31
                 Storage::disk($this->disk)->delete($file);
32 32
             }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             return $this->path.$fileName;
53 53
         }
54 54
 
55
-        if (! $value && CrudPanelFacade::getRequest()->has($this->name) && $previousFile) {
55
+        if (!$value && CrudPanelFacade::getRequest()->has($this->name) && $previousFile) {
56 56
             Storage::disk($this->disk)->delete($previousFile);
57 57
 
58 58
             return null;
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Uploads/Uploaders/SingleBase64Image.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
         $value = $value ?? CRUD::getRequest()->get($this->name);
15 15
         $previousImage = $entry->getOriginal($this->name);
16 16
 
17
-        if (! $value && $previousImage) {
17
+        if (!$value && $previousImage) {
18 18
             Storage::disk($this->disk)->delete($previousImage);
19 19
 
20 20
             return null;
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Macroable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
             if (isset($attributes['subfields'])) {
49 49
                 foreach ($attributes['subfields'] as $subfield) {
50 50
                     if (isset($subfield[$macro])) {
51
-                        $config = ! is_array($subfield[$macro]) ? [] : $subfield[$macro];
51
+                        $config = !is_array($subfield[$macro]) ? [] : $subfield[$macro];
52 52
                         $macroable->{$macro}($config, $subfield);
53 53
                     }
54 54
                 }
Please login to merge, or discard this patch.
src/macros.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 = '';
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Uploads/RegisterUploadEvents.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  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
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
         if ($this->crudObjectType === 'field') {
59
-            $model::saving(function ($entry) use ($uploader) {
59
+            $model::saving(function($entry) use ($uploader) {
60 60
                 $updatedCountKey = 'uploaded_'.($uploader->getRepeatableContainerName() ?? $uploader->getName()).'_count';
61 61
 
62 62
                 CRUD::set($updatedCountKey, CRUD::get($updatedCountKey) ?? 0);
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
             });
70 70
         }
71 71
 
72
-        $model::retrieved(function ($entry) use ($uploader) {
72
+        $model::retrieved(function($entry) use ($uploader) {
73 73
             $entry = $uploader->retrieveUploadedFile($entry);
74 74
         });
75 75
 
76
-        $model::deleting(function ($entry) use ($uploader) {
76
+        $model::deleting(function($entry) use ($uploader) {
77 77
             $uploader->deleteUploadedFile($entry);
78 78
         });
79 79
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     public function registerEvents(array $subfield = [])
84 84
     {
85
-        if (! empty($subfield)) {
85
+        if (!empty($subfield)) {
86 86
             return $this->registerSubfieldEvent($subfield);
87 87
         }
88 88
 
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 
121 121
         // for subfields, we only register one event so that we have access to the repeatable container name.
122 122
         // all the uploaders for a given container are stored in the UploadersRepository.
123
-        if (! app('UploadersRepository')->hasUploadersRegisteredFor($uploader->getRepeatableContainerName())) {
123
+        if (!app('UploadersRepository')->hasUploadersRegisteredFor($uploader->getRepeatableContainerName())) {
124 124
             $this->setupModelEvents($model, $uploader);
125 125
         }
126 126
 
127 127
         $subfields = collect($this->crudObject->getAttributes()['subfields']);
128
-        $subfields = $subfields->map(function ($item) use ($subfield, $uploader) {
128
+        $subfields = $subfields->map(function($item) use ($subfield, $uploader) {
129 129
             if ($item['name'] === $subfield['name']) {
130 130
                 $item['upload'] = true;
131 131
                 $item['disk'] = $uploader->getDisk();
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
     private function getUploader(array $crudObject, array $uploaderConfiguration)
162 162
     {
163 163
         if (isset($uploaderConfiguration['uploaderType'])) {
164
-            return $uploaderConfiguration['uploaderType']::for($crudObject, $uploaderConfiguration);
164
+            return $uploaderConfiguration['uploaderType']::for ($crudObject, $uploaderConfiguration);
165 165
         }
166 166
 
167 167
         if (app('UploadersRepository')->hasUploadFor($crudObject['type'], $this->macro)) {
168
-            return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for($crudObject, $uploaderConfiguration);
168
+            return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for ($crudObject, $uploaderConfiguration);
169 169
         }
170 170
 
171 171
         throw new Exception('Undefined upload type for '.$crudObject['crudObjectType'].' type: '.$crudObject['type']);
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Uploads/Uploaders/Uploader.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
         $value = $this->mergeValuesRecursive($values, $files);
155 155
 
156
-        if (! $this->isRelationship) {
156
+        if (!$this->isRelationship) {
157 157
             $entry->{$this->repeatableContainerName} = json_encode($this->processRepeatableUploads($entry, $value));
158 158
         } else {
159 159
             $modelCount = CRUD::get('uploaded_'.$this->repeatableContainerName.'_count');
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         foreach (app('UploadersRepository')->getRegisteredUploadersFor($this->repeatableContainerName) as $uploader) {
176 176
             $uploadedValues = $uploader->saveRepeatableFile($entry, $value->pluck($uploader->name)->toArray());
177 177
 
178
-            $value = $value->map(function ($item, $key) use ($uploadedValues, $uploader) {
178
+            $value = $value->map(function($item, $key) use ($uploadedValues, $uploader) {
179 179
                 $item[$uploader->getName()] = $uploadedValues[$key] ?? null;
180 180
 
181 181
                 return $item;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     {
255 255
         $value = $entry->{$this->name};
256 256
 
257
-        if ($this->isMultiple && ! isset($entry->getCasts()[$this->name]) && is_string($value)) {
257
+        if ($this->isMultiple && !isset($entry->getCasts()[$this->name]) && is_string($value)) {
258 258
             $entry->{$this->name} = json_decode($value, true);
259 259
         } else {
260 260
             $entry->{$this->name} = Str::after($value, $this->path);
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     public function deleteUploadedFile(Model $entry)
282 282
     {
283 283
         if ($this->deleteWhenEntryIsDeleted) {
284
-            if (! in_array(SoftDeletes::class, class_uses_recursive($entry), true)) {
284
+            if (!in_array(SoftDeletes::class, class_uses_recursive($entry), true)) {
285 285
                 $this->performFileDeletion($entry);
286 286
             } else {
287 287
                 if ($entry->forceDeleting === true) {
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
 
300 300
         $repeatableValues = collect($entry->{$this->getName()});
301 301
         foreach (app('UploadersRepository')->getRegisteredUploadersFor($this->repeatableContainerName) as $upload) {
302
-            if (! $upload->deleteWhenEntryIsDeleted) {
302
+            if (!$upload->deleteWhenEntryIsDeleted) {
303 303
                 continue;
304 304
             }
305 305
             $values = $repeatableValues->pluck($upload->getName())->toArray();
306 306
             foreach ($values as $value) {
307
-                if (! $value) {
307
+                if (!$value) {
308 308
                     continue;
309 309
                 }
310 310
                 if (is_array($value)) {
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
         $values = $entry->{$this->name};
325 325
 
326 326
         if ($this->isMultiple) {
327
-            if (! isset($entry->getCasts()[$this->name]) && is_string($values)) {
327
+            if (!isset($entry->getCasts()[$this->name]) && is_string($values)) {
328 328
                 $values = json_decode($values, true);
329 329
             }
330 330
         } else {
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
      * @param  array  $definition
353 353
      * @return self
354 354
      */
355
-    public static function for(array $crudObject, array $definition)
355
+    public static function for (array $crudObject, array $definition)
356 356
     {
357 357
         return new static($crudObject, $definition);
358 358
     }
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     {
410 410
         $items = CRUD::getRequest()->input('_order_'.$this->repeatableContainerName) ?? [];
411 411
 
412
-        array_walk($items, function (&$key, $value) {
412
+        array_walk($items, function(&$key, $value) {
413 413
             $requestValue = $key[$this->name] ?? null;
414 414
             $key = $this->isMultiple ? (is_string($requestValue) ? explode(',', $requestValue) : $requestValue) : $requestValue;
415 415
         });
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     protected function getPreviousRepeatableValues(Model $entry)
437 437
     {
438 438
         $previousValues = json_decode($entry->getOriginal($this->repeatableContainerName), true);
439
-        if (! empty($previousValues)) {
439
+        if (!empty($previousValues)) {
440 440
             $previousValues = array_column($previousValues, $this->name);
441 441
         }
442 442
 
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Uploads/UploadersRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function markAsHandled(string $objectName)
19 19
     {
20
-        if (! in_array($objectName, $this->handledUploaders)) {
20
+        if (!in_array($objectName, $this->handledUploaders)) {
21 21
             $this->handledUploaders[] = $objectName;
22 22
         }
23 23
     }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function registerUploader(string $uploadName, $uploader)
51 51
     {
52
-        if (! array_key_exists($uploadName, $this->registeredUploaders) || ! in_array($uploader, $this->registeredUploaders[$uploadName])) {
52
+        if (!array_key_exists($uploadName, $this->registeredUploaders) || !in_array($uploader, $this->registeredUploaders[$uploadName])) {
53 53
             $this->registeredUploaders[$uploadName][] = $uploader;
54 54
         }
55 55
     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     public function getRegisteredUploadNames(string $uploadName)
73 73
     {
74
-        return array_map(function ($uploader) {
74
+        return array_map(function($uploader) {
75 75
             return $uploader->getName();
76 76
         }, $this->getRegisteredUploadersFor($uploadName));
77 77
     }
Please login to merge, or discard this patch.