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
24:54 queued 09:59
created
src/app/Library/CrudPanel/Traits/ColumnsProtectedMethods.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             $column = ['name' => $column];
50 50
         }
51 51
 
52
-        if (is_array($column) && ! isset($column['name'])) {
52
+        if (is_array($column) && !isset($column['name'])) {
53 53
             $column['name'] = 'anonymous_column_'.Str::random(5);
54 54
         }
55 55
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function makeSureColumnHasLabel($column)
67 67
     {
68
-        if (! isset($column['label'])) {
68
+        if (!isset($column['label'])) {
69 69
             $column['label'] = mb_ucfirst($this->makeLabel($column['name']));
70 70
         }
71 71
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     protected function makeSureColumnHasKey($column)
148 148
     {
149
-        if (! isset($column['key'])) {
149
+        if (!isset($column['key'])) {
150 150
             $column['key'] = str_replace('.', '__', $column['name']);
151 151
         }
152 152
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     protected function makeSureColumnHasWrapper($column)
166 166
     {
167
-        if (! isset($column['wrapper'])) {
167
+        if (!isset($column['wrapper'])) {
168 168
             $column['wrapper'] = [];
169 169
         }
170 170
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     {
256 256
         // if this is a relation type field and no corresponding model was specified,
257 257
         // get it from the relation method defined in the main model
258
-        if (isset($column['entity']) && $column['entity'] !== false && ! isset($column['model'])) {
258
+        if (isset($column['entity']) && $column['entity'] !== false && !isset($column['model'])) {
259 259
             $column['model'] = $this->getRelationModel($column['entity']);
260 260
         }
261 261
 
@@ -276,8 +276,7 @@  discard block
 block discarded – undo
276 276
         $columnsArray = $this->columns();
277 277
 
278 278
         if (array_key_exists($targetColumnName, $columnsArray)) {
279
-            $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($columnsArray)) :
280
-                array_search($targetColumnName, array_keys($columnsArray)) + 1;
279
+            $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($columnsArray)) : array_search($targetColumnName, array_keys($columnsArray)) + 1;
281 280
 
282 281
             $element = array_pop($columnsArray);
283 282
             $beginningPart = array_slice($columnsArray, 0, $targetColumnPosition, true);
@@ -299,7 +298,7 @@  discard block
 block discarded – undo
299 298
     {
300 299
         static $cache = [];
301 300
 
302
-        if (! $this->driverIsSql()) {
301
+        if (!$this->driverIsSql()) {
303 302
             return true;
304 303
         }
305 304
 
Please login to merge, or discard this patch.
src/app/Http/Controllers/Operations/ShowOperation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,25 +30,25 @@
 block discarded – undo
30 30
         $this->crud->allowAccess('show');
31 31
         $this->crud->setOperationSetting('setFromDb', true);
32 32
 
33
-        $this->crud->operation('show', function () {
33
+        $this->crud->operation('show', function() {
34 34
             $this->crud->loadDefaultOperationSettingsFromConfig();
35 35
 
36
-            if (! method_exists($this, 'setupShowOperation')) {
36
+            if (!method_exists($this, 'setupShowOperation')) {
37 37
                 $this->autoSetupShowOperation();
38 38
             }
39 39
         });
40 40
 
41
-        $this->crud->operation('list', function () {
41
+        $this->crud->operation('list', function() {
42 42
             $this->crud->addButton('line', 'show', 'view', 'crud::buttons.show', 'beginning');
43 43
         });
44 44
 
45
-        $this->crud->operation(['create', 'update'], function () {
45
+        $this->crud->operation(['create', 'update'], function() {
46 46
             $this->crud->addSaveAction([
47 47
                 'name' => 'save_and_preview',
48
-                'visible' => function ($crud) {
48
+                'visible' => function($crud) {
49 49
                     return $crud->hasAccess('show');
50 50
                 },
51
-                'redirect' => function ($crud, $request, $itemId = null) {
51
+                'redirect' => function($crud, $request, $itemId = null) {
52 52
                     $itemId = $itemId ?: $request->input('id');
53 53
                     $redirectUrl = $crud->route.'/'.$itemId.'/show';
54 54
                     if ($request->has('_locale')) {
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
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
         foreach ($fields as &$field) {
55 55
             // set the value
56
-            if (! isset($field['value'])) {
56
+            if (!isset($field['value'])) {
57 57
                 if (isset($field['subfields'])) {
58 58
                     $field['value'] = [];
59 59
                     foreach ($field['subfields'] as $subfield) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         }
67 67
 
68 68
         // always have a hidden input for the entry id
69
-        if (! array_key_exists('id', $fields)) {
69
+        if (!array_key_exists('id', $fields)) {
70 70
             $fields['id'] = [
71 71
                 'name'  => $entry->getKeyName(),
72 72
                 'value' => $entry->getKey(),
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         [$related_model, $relation_method] = $this->getModelAndMethodFromEntity($model, $field);
110 110
 
111
-        if (! method_exists($related_model, $relation_method)) {
111
+        if (!method_exists($related_model, $relation_method)) {
112 112
             return $related_model->{$relation_method};
113 113
         }
114 114
 
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
             case 'HasMany':
120 120
             case 'BelongsToMany':
121 121
             case 'MorphToMany':
122
-                if (! isset($field['pivotFields'])) {
122
+                if (!isset($field['pivotFields'])) {
123 123
                     return $related_model->{$relation_method};
124 124
                 }
125 125
                 // we want to exclude the "self pivot field" since we already have it.
126
-                $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) {
126
+                $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) {
127 127
                     return $field['name'] != $item['name'];
128 128
                 });
129 129
                 $related_models = $related_model->{$relation_method};
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             break;
161 161
             case 'HasOne':
162 162
             case 'MorphOne':
163
-                if (! $related_model->{$relation_method}) {
163
+                if (!$related_model->{$relation_method}) {
164 164
                     return;
165 165
                 }
166 166
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
         $relation_array = explode('.', $relational_entity);
181 181
 
182
-        $related_model = array_reduce(array_splice($relation_array, 0, -1), function ($obj, $method) {
182
+        $related_model = array_reduce(array_splice($relation_array, 0, -1), function($obj, $method) {
183 183
             $method = Str::endsWith($method, '_id') ? Str::replaceLast('_id', '', $method) : $method;
184 184
 
185 185
             return $obj->{$method} ? $obj->{$method} : $obj;
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Relationships.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $model = $this->getRelationModel($field['entity'], -1);
63 63
         $lastSegmentAfterDot = Str::of($field['entity'])->afterLast('.');
64 64
 
65
-        if (! method_exists($model, $lastSegmentAfterDot)) {
65
+        if (!method_exists($model, $lastSegmentAfterDot)) {
66 66
             return (string) Str::of($field['entity'])->beforeLast('.');
67 67
         }
68 68
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         return collect($this->fields())
84 84
             ->where('model')
85 85
             ->whereIn('relation_type', $relation_types)
86
-            ->filter(function ($item) {
86
+            ->filter(function($item) {
87 87
                 $related_model = get_class($this->model->{Str::before($item['entity'], '.')}()->getRelated());
88 88
 
89 89
                 return Str::contains($item['entity'], '.') && $item['model'] !== $related_model ? false : true;
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
     {
208 208
         $all_relation_fields = $this->getRelationFields();
209 209
 
210
-        return Arr::where($all_relation_fields, function ($value, $key) {
211
-            return isset($value['pivot']) && ! $value['pivot'];
210
+        return Arr::where($all_relation_fields, function($value, $key) {
211
+            return isset($value['pivot']) && !$value['pivot'];
212 212
         });
213 213
     }
214 214
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     {
222 222
         $all_relation_fields = $this->getRelationFields();
223 223
 
224
-        return Arr::where($all_relation_fields, function ($value, $key) {
224
+        return Arr::where($all_relation_fields, function($value, $key) {
225 225
             return isset($value['pivot']) && $value['pivot'];
226 226
         });
227 227
     }
Please login to merge, or discard this patch.
database/migrations/2020_03_31_114745_create_pivotable_relations_tables.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('comments', function (Blueprint $table) {
16
+        Schema::create('comments', function(Blueprint $table) {
17 17
             $table->bigIncrements('id');
18 18
             $table->string('text')->nullable();
19 19
             $table->morphs('commentable');
20 20
             $table->timestamps();
21 21
         });
22 22
 
23
-        Schema::create('recommendables', function (Blueprint $table) {
23
+        Schema::create('recommendables', function(Blueprint $table) {
24 24
             $table->bigIncrements('id');
25 25
             $table->string('text')->nullable();
26 26
             $table->morphs('recommendable');
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             $table->timestamps();
29 29
         });
30 30
 
31
-        Schema::create('billables', function (Blueprint $table) {
31
+        Schema::create('billables', function(Blueprint $table) {
32 32
             $table->bigIncrements('id');
33 33
             $table->string('text')->nullable();
34 34
             $table->morphs('billable');
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             $table->timestamps();
37 37
         });
38 38
 
39
-        Schema::create('articles_user', function (Blueprint $table) {
39
+        Schema::create('articles_user', function(Blueprint $table) {
40 40
             $table->increments('id');
41 41
             $table->integer('article_id')->unsigned();
42 42
             $table->integer('user_id')->unsigned();
@@ -44,38 +44,38 @@  discard block
 block discarded – undo
44 44
             $table->nullableTimestamps();
45 45
         });
46 46
 
47
-        Schema::create('recommends', function (Blueprint $table) {
47
+        Schema::create('recommends', function(Blueprint $table) {
48 48
             $table->bigIncrements('id');
49 49
             $table->string('title')->nullable();
50 50
             $table->timestamps();
51 51
         });
52 52
 
53
-        Schema::create('bills', function (Blueprint $table) {
53
+        Schema::create('bills', function(Blueprint $table) {
54 54
             $table->bigIncrements('id');
55 55
             $table->string('title')->nullable();
56 56
             $table->timestamps();
57 57
         });
58 58
 
59
-        Schema::create('stars', function (Blueprint $table) {
59
+        Schema::create('stars', function(Blueprint $table) {
60 60
             $table->bigIncrements('id');
61 61
             $table->string('starable_type');
62 62
             $table->bigInteger('starable_id');
63 63
             $table->string('title')->nullable();
64 64
         });
65 65
 
66
-        Schema::create('universes', function (Blueprint $table) {
66
+        Schema::create('universes', function(Blueprint $table) {
67 67
             $table->bigIncrements('id');
68 68
             $table->bigInteger('user_id');
69 69
             $table->string('title')->nullable();
70 70
         });
71 71
 
72
-        Schema::create('planets', function (Blueprint $table) {
72
+        Schema::create('planets', function(Blueprint $table) {
73 73
             $table->bigIncrements('id');
74 74
             $table->bigInteger('user_id')->nullable();
75 75
             $table->string('title')->nullable();
76 76
         });
77 77
 
78
-        Schema::create('comets', function (Blueprint $table) {
78
+        Schema::create('comets', function(Blueprint $table) {
79 79
             $table->bigIncrements('id');
80 80
             $table->bigInteger('user_id')->default(0);
81 81
         });
Please login to merge, or discard this patch.
src/app/Models/Traits/HasRelationshipFields.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         [$conn, $table] = self::getConnectionAndTable();
68 68
 
69 69
         // MongoDB columns are alway nullable
70
-        if (! in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) {
70
+        if (!in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) {
71 71
             return true;
72 72
         }
73 73
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             // check for NOT NULL
78 78
             $notNull = $column->getNotnull();
79 79
             // return the value of nullable (aka the inverse of NOT NULL)
80
-            return ! $notNull;
80
+            return !$notNull;
81 81
         } catch (\Exception $e) {
82 82
             return true;
83 83
         }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         [$conn, $table] = self::getConnectionAndTable();
95 95
 
96 96
         // MongoDB columns don't have default values
97
-        if (! in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) {
97
+        if (!in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) {
98 98
             return false;
99 99
         }
100 100
 
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Validation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
         // construct the validation rules array
30 30
         // (eg. ['name' => 'required|min:2'])
31 31
         $rules = collect($fields)
32
-                    ->filter(function ($value, $key) {
32
+                    ->filter(function($value, $key) {
33 33
                         // only keep fields where 'validationRules' attribute is defined
34 34
                         return array_key_exists('validationRules', $value);
35
-                    })->map(function ($item, $key) {
35
+                    })->map(function($item, $key) {
36 36
                         // only keep the rules, not the entire field definition
37 37
                         return $item['validationRules'];
38 38
                     })->toArray();
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
         // (eg. ['title.required' => 'You gotta write smth man.'])
42 42
         $messages = [];
43 43
         collect($fields)
44
-                    ->filter(function ($value, $key) {
44
+                    ->filter(function($value, $key) {
45 45
                         // only keep fields where 'validationMessages' attribute is defined
46 46
                         return array_key_exists('validationMessages', $value);
47
-                    })->each(function ($item, $key) use (&$messages) {
47
+                    })->each(function($item, $key) use (&$messages) {
48 48
                         foreach ($item['validationMessages'] as $rule => $message) {
49 49
                             $messages[$key.'.'.$rule] = $message;
50 50
                         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function setValidation($classOrRulesArray = false, $messages = [])
76 76
     {
77
-        if (! $classOrRulesArray) {
77
+        if (!$classOrRulesArray) {
78 78
             $this->setValidationFromFields();
79 79
         } elseif (is_array($classOrRulesArray)) {
80 80
             $this->setValidationFromArray($classOrRulesArray, $messages);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function isRequired($inputKey)
204 204
     {
205
-        if (! $this->hasOperationSetting('requiredFields')) {
205
+        if (!$this->hasOperationSetting('requiredFields')) {
206 206
             return false;
207 207
         }
208 208
 
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
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $fields_with_pivot = $this->getRelationFieldsWithPivot();
102 102
 
103 103
         //remove fields that are not in the submitted form input
104
-        $fields_with_pivot = array_filter($fields_with_pivot, function ($item) use ($input) {
104
+        $fields_with_pivot = array_filter($fields_with_pivot, function($item) use ($input) {
105 105
             return Arr::has($input, $item['name']);
106 106
         });
107 107
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
      */
157 157
     private function createRelationsForItem($item, $formattedRelations)
158 158
     {
159
-        if (! isset($formattedRelations['relations'])) {
159
+        if (!isset($formattedRelations['relations'])) {
160 160
             return false;
161 161
         }
162 162
         foreach ($formattedRelations['relations'] as $relationMethod => $relationDetails) {
163
-            if (! isset($relationDetails['model'])) {
163
+            if (!isset($relationDetails['model'])) {
164 164
                 continue;
165 165
             }
166 166
             $model = $relationDetails['model'];
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             return $removed_entries->delete();
244 244
         }
245 245
 
246
-        if (! $relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) {
246
+        if (!$relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) {
247 247
             return $removed_entries->update([$relation_foreign_key => $model_instance->getDbColumnDefault($relation_foreign_key)]);
248 248
         }
249 249
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         $created_ids = [];
267 267
 
268 268
         foreach ($items as $item) {
269
-            if (isset($item[$relation_local_key]) && ! empty($item[$relation_local_key])) {
269
+            if (isset($item[$relation_local_key]) && !empty($item[$relation_local_key])) {
270 270
                 $entry->{$relationMethod}()->updateOrCreate([$relation_local_key => $item[$relation_local_key]], Arr::except($item, $relation_local_key));
271 271
             } else {
272 272
                 $created_ids[] = $entry->{$relationMethod}()->create($item)->{$relation_local_key};
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         // get from $items the sent ids, and merge the ones created.
277 277
         $relatedItemsSent = array_merge(array_filter(Arr::pluck($items, $relation_local_key)), $created_ids);
278 278
 
279
-        if (! empty($relatedItemsSent)) {
279
+        if (!empty($relatedItemsSent)) {
280 280
             // we perform the cleanup of removed database items
281 281
             $entry->{$relationMethod}()->whereNotIn($relation_local_key, $relatedItemsSent)->delete();
282 282
         }
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
         $relationFields = $this->getRelationFieldsWithoutPivot();
307 307
 
308 308
         //remove fields that are not in the submitted form input
309
-        $relationFields = array_filter($relationFields, function ($item) use ($input) {
309
+        $relationFields = array_filter($relationFields, function($item) use ($input) {
310 310
             return Arr::has($input, $item['name']);
311 311
         });
312 312
 
313 313
         // exclude the already attached belongs to relations in the main entry but include nested belongs to.
314
-        $relationFields = Arr::where($relationFields, function ($field, $key) {
314
+        $relationFields = Arr::where($relationFields, function($field, $key) {
315 315
             return $field['relation_type'] !== 'BelongsTo' || ($field['relation_type'] === 'BelongsTo' && Str::contains($field['name'], '.'));
316 316
         });
317 317
 
Please login to merge, or discard this patch.