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 — fix-uploaders (#5518)
by Cristian
26:16 queued 10:39
created
src/app/Library/Uploaders/Support/RegisterUploadEvents.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
     private string $crudObjectType;
15 15
 
16 16
     public function __construct(
17
-        private readonly CrudField|CrudColumn $crudObject,
17
+        private readonly CrudField | CrudColumn $crudObject,
18 18
         private readonly array $uploaderConfiguration,
19 19
         private readonly string $macro
20 20
         ) {
21 21
         $this->crudObjectType = is_a($crudObject, CrudField::class) ? 'field' : (is_a($crudObject, CrudColumn::class) ? 'column' : null);
22 22
 
23
-        if (! $this->crudObjectType) {
23
+        if (!$this->crudObjectType) {
24 24
             abort(500, 'Upload handlers only work for CrudField and CrudColumn classes.');
25 25
         }
26 26
     }
27 27
 
28
-    public static function handle(CrudField|CrudColumn $crudObject, array $uploaderConfiguration, string $macro, ?array $subfield = null, ?bool $registerModelEvents = true): void
28
+    public static function handle(CrudField | CrudColumn $crudObject, array $uploaderConfiguration, string $macro, ?array $subfield = null, ?bool $registerModelEvents = true): void
29 29
     {
30 30
         $instance = new self($crudObject, $uploaderConfiguration, $macro);
31 31
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
     /*******************************
36 36
      * Private methods - implementation
37 37
      *******************************/
38
-    private function registerEvents(array|null $subfield = [], ?bool $registerModelEvents = true): void
38
+    private function registerEvents(array | null $subfield = [], ?bool $registerModelEvents = true): void
39 39
     {
40
-        if (! empty($subfield)) {
40
+        if (!empty($subfield)) {
41 41
             $this->registerSubfieldEvent($subfield, $registerModelEvents);
42 42
 
43 43
             return;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         }
83 83
 
84 84
         $subfields = collect($this->crudObject->getAttributes()['subfields']);
85
-        $subfields = $subfields->map(function ($item) use ($subfield, $uploader) {
85
+        $subfields = $subfields->map(function($item) use ($subfield, $uploader) {
86 86
             if ($item['name'] === $subfield['name']) {
87 87
                 $item['upload'] = true;
88 88
                 $item['disk'] = $uploader->getDisk();
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         if ($this->crudObjectType === 'field') {
115
-            $model::saving(function ($entry) use ($uploader) {
115
+            $model::saving(function($entry) use ($uploader) {
116 116
                 $entry = $uploader->storeUploadedFiles($entry);
117 117
             });
118 118
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             // is not called in pivot models when loading the relations.
126 126
             $retrieveModel = $this->getModelForRetrieveEvent($model, $uploader);
127 127
 
128
-            $retrieveModel::retrieved(function ($entry) use ($uploader) {
128
+            $retrieveModel::retrieved(function($entry) use ($uploader) {
129 129
                 if ($entry->translationEnabled()) {
130 130
                     $locale = request('_locale', app()->getLocale());
131 131
                     if (in_array($locale, array_keys($entry->getAvailableLocales()))) {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             });
137 137
         }
138 138
 
139
-        $model::deleting(function ($entry) use ($uploader) {
139
+        $model::deleting(function($entry) use ($uploader) {
140 140
             $uploader->deleteUploadedFiles($entry);
141 141
         });
142 142
 
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $hasCustomUploader = isset($uploaderConfiguration['uploader']);
159 159
 
160
-        if ($hasCustomUploader && ! is_a($uploaderConfiguration['uploader'], UploaderInterface::class, true)) {
160
+        if ($hasCustomUploader && !is_a($uploaderConfiguration['uploader'], UploaderInterface::class, true)) {
161 161
             throw new Exception('Invalid uploader class provided for '.$this->crudObjectType.' type: '.$crudObject['type']);
162 162
         }
163 163
 
164 164
         if ($hasCustomUploader) {
165
-            return $uploaderConfiguration['uploader']::for($crudObject, $uploaderConfiguration);
165
+            return $uploaderConfiguration['uploader']::for ($crudObject, $uploaderConfiguration);
166 166
         }
167 167
 
168 168
         $uploader = app('UploadersRepository')->hasUploadFor($crudObject['type'], $this->macro);
169 169
 
170 170
         if ($uploader) {
171
-            return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for($crudObject, $uploaderConfiguration);
171
+            return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for ($crudObject, $uploaderConfiguration);
172 172
         }
173 173
 
174 174
         throw new Exception('Undefined upload type for '.$this->crudObjectType.' type: '.$crudObject['type']);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
     private function getSubfieldModel(array $subfield, UploaderInterface $uploader)
191 191
     {
192
-        if (! $uploader->isRelationship()) {
192
+        if (!$uploader->isRelationship()) {
193 193
             return $subfield['baseModel'] ?? get_class(app('crud')->getModel());
194 194
         }
195 195
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
     private function getModelForRetrieveEvent(string $model, UploaderInterface $uploader)
204 204
     {
205
-        if (! $uploader->isRelationship()) {
205
+        if (!$uploader->isRelationship()) {
206 206
             return $model;
207 207
         }
208 208
 
Please login to merge, or discard this patch.