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 Setup Failed
Pull Request — master (#2940)
by Cristian
36:16 queued 21:12
created
src/helpers.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! function_exists('backpack_url')) {
3
+if (!function_exists('backpack_url')) {
4 4
     /**
5 5
      * Appends the configured backpack prefix and returns
6 6
      * the URL using the standard Laravel helpers.
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
      */
11 11
     function backpack_url($path = null, $parameters = [], $secure = null)
12 12
     {
13
-        $path = ! $path || (substr($path, 0, 1) == '/') ? $path : '/'.$path;
13
+        $path = !$path || (substr($path, 0, 1) == '/') ? $path : '/'.$path;
14 14
 
15 15
         return url(config('backpack.base.route_prefix', 'admin').$path, $parameters, $secure);
16 16
     }
17 17
 }
18 18
 
19
-if (! function_exists('backpack_authentication_column')) {
19
+if (!function_exists('backpack_authentication_column')) {
20 20
     /**
21 21
      * Return the username column name.
22 22
      * The Laravel default (and Backpack default) is 'email'.
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     }
30 30
 }
31 31
 
32
-if (! function_exists('backpack_form_input')) {
32
+if (!function_exists('backpack_form_input')) {
33 33
     /**
34 34
      * Parse the submitted input in request('form') to an usable array.
35 35
      * Joins the multiple[] fields in a single key and transform the dot notation fields into arrayed ones.
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             }
59 59
 
60 60
             if (is_null($input_arg)) {
61
-                if (! isset($result[$input_key])) {
61
+                if (!isset($result[$input_key])) {
62 62
                     $result[$input_key] = $start ? [$row['value']] : $row['value'];
63 63
                 } else {
64 64
                     array_push($result[$input_key], $row['value']);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     }
73 73
 }
74 74
 
75
-if (! function_exists('backpack_users_have_email')) {
75
+if (!function_exists('backpack_users_have_email')) {
76 76
     /**
77 77
      * Check if the email column is present on the user table.
78 78
      *
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     }
88 88
 }
89 89
 
90
-if (! function_exists('backpack_avatar_url')) {
90
+if (!function_exists('backpack_avatar_url')) {
91 91
     /**
92 92
      * Returns the avatar URL of a user.
93 93
      *
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     }
120 120
 }
121 121
 
122
-if (! function_exists('backpack_middleware')) {
122
+if (!function_exists('backpack_middleware')) {
123 123
     /**
124 124
      * Return the key of the middleware used across Backpack.
125 125
      * That middleware checks if the visitor is an admin.
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     }
134 134
 }
135 135
 
136
-if (! function_exists('backpack_guard_name')) {
136
+if (!function_exists('backpack_guard_name')) {
137 137
     /*
138 138
      * Returns the name of the guard defined
139 139
      * by the application config
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     }
145 145
 }
146 146
 
147
-if (! function_exists('backpack_auth')) {
147
+if (!function_exists('backpack_auth')) {
148 148
     /*
149 149
      * Returns the user instance if it exists
150 150
      * of the currently authenticated admin
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     }
157 157
 }
158 158
 
159
-if (! function_exists('backpack_user')) {
159
+if (!function_exists('backpack_user')) {
160 160
     /*
161 161
      * Returns back a user instance without
162 162
      * the admin guard, however allows you
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     }
169 169
 }
170 170
 
171
-if (! function_exists('mb_ucfirst')) {
171
+if (!function_exists('mb_ucfirst')) {
172 172
     /**
173 173
      * Capitalize the first letter of a string,
174 174
      * even if that string is multi-byte (non-latin alphabet).
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     }
190 190
 }
191 191
 
192
-if (! function_exists('backpack_view')) {
192
+if (!function_exists('backpack_view')) {
193 193
     /**
194 194
      * Returns a new displayable view based on the configured backpack view namespace.
195 195
      * If that view doesn't exist, it will load the one from the original theme.
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
         $returnView = $theme.$view;
210 210
 
211
-        if (! view()->exists($returnView)) {
211
+        if (!view()->exists($returnView)) {
212 212
             $returnView = $originalTheme.$view;
213 213
         }
214 214
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     }
217 217
 }
218 218
 
219
-if (! function_exists('square_brackets_to_dots')) {
219
+if (!function_exists('square_brackets_to_dots')) {
220 220
     /**
221 221
      * Turns a string from bracket-type array to dot-notation array.
222 222
      * Ex: array[0][property] turns into array.0.property.
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     }
233 233
 }
234 234
 
235
-if (! function_exists('is_countable')) {
235
+if (!function_exists('is_countable')) {
236 236
     /**
237 237
      * We need this because is_countable was only introduced in PHP 7.3,
238 238
      * and in PHP 7.2 you should check if count() argument is really countable.
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     }
248 248
 }
249 249
 
250
-if (! function_exists('old_empty_or_null')) {
250
+if (!function_exists('old_empty_or_null')) {
251 251
     /**
252 252
      * This method is an alternative to Laravel's old() helper, which mistakenly
253 253
      * returns NULL it two cases:
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/FieldsProtectedMethods.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function overwriteFieldNameFromDotNotationToArray($field)
70 70
     {
71
-        if (! is_array($field['name']) && strpos($field['name'], '.') !== false) {
71
+        if (!is_array($field['name']) && strpos($field['name'], '.') !== false) {
72 72
             $entity_array = explode('.', $field['name']);
73 73
             $name_string = '';
74 74
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             return ['name' => $field];
111 111
         }
112 112
 
113
-        if (is_array($field) && ! isset($field['name'])) {
113
+        if (is_array($field) && !isset($field['name'])) {
114 114
             abort(500, 'All fields must have their name defined');
115 115
         }
116 116
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     {
174 174
         // if there's a model defined, but no attribute
175 175
         // guess an attribute using the identifiableAttribute functionality in CrudTrait
176
-        if (isset($field['model']) && ! isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) {
176
+        if (isset($field['model']) && !isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) {
177 177
             $field['attribute'] = call_user_func([(new $field['model']()), 'identifiableAttribute']);
178 178
         }
179 179
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     protected function makeSureFieldHasLabel($field)
191 191
     {
192
-        if (! isset($field['label'])) {
192
+        if (!isset($field['label'])) {
193 193
             $name = is_array($field['name']) ? $field['name'][0] : $field['name'];
194 194
             $name = str_replace('_id', '', $name);
195 195
             $field['label'] = mb_ucfirst(str_replace('_', ' ', $name));
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      */
208 208
     protected function makeSureFieldHasType($field)
209 209
     {
210
-        if (! isset($field['type'])) {
210
+        if (!isset($field['type'])) {
211 211
             $field['type'] = isset($field['relation_type']) ? 'relationship' : $this->inferFieldTypeFromDbColumnType($field['name']);
212 212
         }
213 213
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     {
225 225
         // if a tab was mentioned, we should enable it
226 226
         if (isset($field['tab'])) {
227
-            if (! $this->tabsEnabled()) {
227
+            if (!$this->tabsEnabled()) {
228 228
                 $this->enableTabs();
229 229
             }
230 230
         }
Please login to merge, or discard this patch.
src/resources/views/crud/fields/checklist_dependency.blade.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,35 +33,35 @@
 block discarded – undo
33 33
         $old_primary_dependency = old_empty_or_null($primary_dependency['name'], false) ?? false;
34 34
         $old_secondary_dependency = old_empty_or_null($secondary_dependency['name'], false) ?? false;
35 35
 
36
-      //for update form, get initial state of the entity
37
-      if (isset($id) && $id) {
36
+        //for update form, get initial state of the entity
37
+        if (isset($id) && $id) {
38 38
 
39 39
         //get entity with relations for primary dependency
40
-          $entity_dependencies = $entity_model->with($primary_dependency['entity'])
41
-          ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary'])
42
-          ->find($id);
40
+            $entity_dependencies = $entity_model->with($primary_dependency['entity'])
41
+            ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary'])
42
+            ->find($id);
43 43
 
44
-          $secondaries_from_primary = [];
44
+            $secondaries_from_primary = [];
45 45
 
46
-          //convert relation in array
47
-          $primary_array = $entity_dependencies->{$primary_dependency['entity']}->toArray();
46
+            //convert relation in array
47
+            $primary_array = $entity_dependencies->{$primary_dependency['entity']}->toArray();
48 48
 
49
-          $secondary_ids = [];
50
-          //create secondary dependency from primary relation, used to check what checkbox must be checked from second checklist
51
-          if ($old_primary_dependency) {
52
-              foreach ($old_primary_dependency as $primary_item) {
53
-                  foreach ($dependencyArray[$primary_item] as $second_item) {
54
-                      $secondary_ids[$second_item] = $second_item;
55
-                  }
56
-              }
57
-          } else { //create dependencies from relation if not from validate error
58
-              foreach ($primary_array as $primary_item) {
59
-                  foreach ($primary_item[$secondary_dependency['entity']] as $second_item) {
60
-                      $secondary_ids[$second_item['id']] = $second_item['id'];
61
-                  }
62
-              }
63
-          }
64
-      }
49
+            $secondary_ids = [];
50
+            //create secondary dependency from primary relation, used to check what checkbox must be checked from second checklist
51
+            if ($old_primary_dependency) {
52
+                foreach ($old_primary_dependency as $primary_item) {
53
+                    foreach ($dependencyArray[$primary_item] as $second_item) {
54
+                        $secondary_ids[$second_item] = $second_item;
55
+                    }
56
+                }
57
+            } else { //create dependencies from relation if not from validate error
58
+                foreach ($primary_array as $primary_item) {
59
+                    foreach ($primary_item[$secondary_dependency['entity']] as $second_item) {
60
+                        $secondary_ids[$second_item['id']] = $second_item['id'];
61
+                    }
62
+                }
63
+            }
64
+        }
65 65
 
66 66
         //json encode of dependency matrix
67 67
         $dependencyJson = json_encode($dependencyArray);
Please login to merge, or discard this patch.
src/resources/views/crud/fields/date_range.blade.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
 <?php
4 4
     // if the column has been cast to Carbon or Date (using attribute casting)
5 5
     // get the value as a date string
6
-    if (! function_exists('formatDate')) {
6
+    if (!function_exists('formatDate')) {
7 7
         function formatDate($entry, $dateFieldName)
8 8
         {
9 9
             $formattedDate = null;
10
-            if (isset($entry) && ! empty($entry->{$dateFieldName})) {
10
+            if (isset($entry) && !empty($entry->{$dateFieldName})) {
11 11
                 $dateField = $entry->{$dateFieldName};
12 12
                 if ($dateField instanceof \Carbon\CarbonInterface) {
13 13
                     $formattedDate = $dateField->format('Y-m-d H:i:s');
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     }
22 22
 
23 23
     if (isset($field['value'])) {
24
-        if (isset($entry) && ! is_array($field['value'])) {
24
+        if (isset($entry) && !is_array($field['value'])) {
25 25
             $start_value = formatDate($entry, $field['name'][0]);
26 26
             $end_value = formatDate($entry, $field['name'][1]);
27 27
         } elseif (is_array($field['value'])) { // gets here when inside repeatable
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Update.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
         // always have a hidden input for the entry id
59
-        if (! array_key_exists('id', $fields)) {
59
+        if (!array_key_exists('id', $fields)) {
60 60
             $fields['id'] = [
61 61
                 'name'  => $entry->getKeyName(),
62 62
                 'value' => $entry->getKey(),
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         [$related_model, $relation_method] = $this->getModelAndMethodFromEntity($model, $field);
100 100
 
101
-        if (! method_exists($related_model, $relation_method)) {
101
+        if (!method_exists($related_model, $relation_method)) {
102 102
             return $related_model->{$relation_method};
103 103
         }
104 104
 
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
             case 'BelongsToMany':
111 111
             case 'MorphToMany':
112 112
                 // use subfields aka. pivotFields
113
-                if (! isset($field['subfields'])) {
113
+                if (!isset($field['subfields'])) {
114 114
                     return $related_model->{$relation_method};
115 115
                 }
116 116
                 // we want to exclude the "self pivot field" since we already have it.
117
-                $pivot_fields = Arr::where($field['subfields'], function ($item) use ($field) {
117
+                $pivot_fields = Arr::where($field['subfields'], function($item) use ($field) {
118 118
                     return $field['name'] != $item['name'];
119 119
                 });
120 120
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
                 break;
145 145
             case 'HasOne':
146 146
             case 'MorphOne':
147
-                if (! method_exists($related_model, $relation_method)) {
147
+                if (!method_exists($related_model, $relation_method)) {
148 148
                     return;
149 149
                 }
150 150
 
151 151
                 $related_entry = $related_model->{$relation_method};
152 152
 
153
-                if (! $related_entry) {
153
+                if (!$related_entry) {
154 154
                     return;
155 155
                 }
156 156
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
         $relation_array = explode('.', $relational_entity);
185 185
 
186
-        $related_model = array_reduce(array_splice($relation_array, 0, -1), function ($obj, $method) {
186
+        $related_model = array_reduce(array_splice($relation_array, 0, -1), function($obj, $method) {
187 187
             $method = Str::endsWith($method, '_id') ? Str::replaceLast('_id', '', $method) : $method;
188 188
 
189 189
             return $obj->{$method} ? $obj->{$method} : $obj;
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Create.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $fields_with_pivot = $this->getRelationFieldsWithPivot();
109 109
 
110 110
         //remove fields that are not in the submitted form input
111
-        $fields_with_pivot = array_filter($fields_with_pivot, function ($item) use ($input) {
111
+        $fields_with_pivot = array_filter($fields_with_pivot, function($item) use ($input) {
112 112
             return Arr::has($input, $item['name']);
113 113
         });
114 114
 
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
      */
164 164
     private function createRelationsForItem($item, $formattedRelations)
165 165
     {
166
-        if (! isset($formattedRelations['relations'])) {
166
+        if (!isset($formattedRelations['relations'])) {
167 167
             return false;
168 168
         }
169 169
         foreach ($formattedRelations['relations'] as $relationMethod => $relationDetails) {
170
-            if (! isset($relationDetails['model'])) {
170
+            if (!isset($relationDetails['model'])) {
171 171
                 continue;
172 172
             }
173 173
             $model = $relationDetails['model'];
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             return $removed_entries->delete();
304 304
         }
305 305
 
306
-        if (! $relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) {
306
+        if (!$relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) {
307 307
             return $removed_entries->update([$relation_foreign_key => $model_instance->getDbColumnDefault($relation_foreign_key)]);
308 308
         }
309 309
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         $created_ids = [];
327 327
 
328 328
         foreach ($items as $item) {
329
-            if (isset($item[$relation_local_key]) && ! empty($item[$relation_local_key])) {
329
+            if (isset($item[$relation_local_key]) && !empty($item[$relation_local_key])) {
330 330
                 $entry->{$relationMethod}()->where($relation_local_key, $item[$relation_local_key])->update(Arr::except($item, $relation_local_key));
331 331
             } else {
332 332
                 $created_ids[] = $entry->{$relationMethod}()->create($item)->{$relation_local_key};
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
         // get from $items the sent ids, and merge the ones created.
337 337
         $relatedItemsSent = array_merge(array_filter(Arr::pluck($items, $relation_local_key)), $created_ids);
338 338
 
339
-        if (! empty($relatedItemsSent)) {
339
+        if (!empty($relatedItemsSent)) {
340 340
             // we perform the cleanup of removed database items
341 341
             $entry->{$relationMethod}()->whereNotIn($relation_local_key, $relatedItemsSent)->delete();
342 342
         }
@@ -366,12 +366,12 @@  discard block
 block discarded – undo
366 366
         $relationFields = $this->getRelationFieldsWithoutPivot();
367 367
 
368 368
         //remove fields that are not in the submitted form input
369
-        $relationFields = array_filter($relationFields, function ($item) use ($input) {
369
+        $relationFields = array_filter($relationFields, function($item) use ($input) {
370 370
             return Arr::has($input, $item['name']);
371 371
         });
372 372
 
373 373
         // exclude the already attached belongs to relations in the main entry but include nested belongs to.
374
-        $relationFields = Arr::where($relationFields, function ($field, $key) {
374
+        $relationFields = Arr::where($relationFields, function($field, $key) {
375 375
             return $field['relation_type'] !== 'BelongsTo' || ($field['relation_type'] === 'BelongsTo' && Str::contains($field['name'], '.'));
376 376
         });
377 377
 
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/CrudButton.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     {
275 275
         $type = $this->name;
276 276
 
277
-        $paths = array_map(function ($item) use ($type) {
277
+        $paths = array_map(function($item) use ($type) {
278 278
             return $item.'.'.$type;
279 279
         }, config('backpack.crud.view_namespaces.buttons'));
280 280
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
     {
441 441
         $itemExists = $this->collection()->contains('name', $this->name);
442 442
 
443
-        if (! $itemExists) {
443
+        if (!$itemExists) {
444 444
             if ($this->position == 'beginning') {
445 445
                 $this->collection()->prepend($this);
446 446
             } else {
Please login to merge, or discard this patch.
src/app/Library/Widget.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         }
135 135
 
136 136
         $type = $this->type;
137
-        $paths = array_map(function ($item) use ($type) {
137
+        $paths = array_map(function($item) use ($type) {
138 138
             return $item.'.'.$type;
139 139
         }, config('backpack.base.component_view_namespaces.widgets'));
140 140
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $itemExists = $this->collection()->contains('name', $this->attributes['name']);
229 229
 
230
-        if (! $itemExists) {
230
+        if (!$itemExists) {
231 231
             $this->collection()->put($this->attributes['name'], $this);
232 232
         } else {
233 233
             $this->collection()[$this->name] = $this;
Please login to merge, or discard this patch.