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
Pull Request — master (#3410)
by Cristian
12:28
created
database/migrations/2017_09_08_000001_create_account_details_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('account_details', function (Blueprint $table) {
16
+        Schema::create('account_details', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->integer('user_id')->unsigned();
19 19
             $table->string('nickname');
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/ColumnsProtectedMethods.php 1 patch
Spacing   +9 added lines, -10 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
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
     {
83 83
         // if it's got a method on the model with the same name
84 84
         // then it should be a relationship
85
-        if (! isset($column['type']) && method_exists($this->model, $column['name'])) {
85
+        if (!isset($column['type']) && method_exists($this->model, $column['name'])) {
86 86
             $column['type'] = 'relationship';
87 87
         }
88 88
 
89
-        if (! isset($column['type'])) {
89
+        if (!isset($column['type'])) {
90 90
             $column['type'] = 'text';
91 91
         }
92 92
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     protected function makeSureColumnHasKey($column)
105 105
     {
106
-        if (! isset($column['key'])) {
106
+        if (!isset($column['key'])) {
107 107
             $column['key'] = str_replace('.', '__', $column['name']);
108 108
         }
109 109
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     protected function makeSureColumnHasWrapper($column)
123 123
     {
124
-        if (! isset($column['wrapper'])) {
124
+        if (!isset($column['wrapper'])) {
125 125
             $column['wrapper'] = [];
126 126
         }
127 127
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     {
140 140
         // if this is a relation type field and no corresponding model was specified,
141 141
         // get it from the relation method defined in the main model
142
-        if (isset($column['entity']) && ! isset($column['model'])) {
142
+        if (isset($column['entity']) && !isset($column['model'])) {
143 143
             $column['model'] = $this->getRelationModel($column['entity']);
144 144
         }
145 145
 
@@ -160,8 +160,7 @@  discard block
 block discarded – undo
160 160
         $columnsArray = $this->columns();
161 161
 
162 162
         if (array_key_exists($targetColumnName, $columnsArray)) {
163
-            $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($columnsArray)) :
164
-                array_search($targetColumnName, array_keys($columnsArray)) + 1;
163
+            $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($columnsArray)) : array_search($targetColumnName, array_keys($columnsArray)) + 1;
165 164
 
166 165
             $element = array_pop($columnsArray);
167 166
             $beginningPart = array_slice($columnsArray, 0, $targetColumnPosition, true);
@@ -184,7 +183,7 @@  discard block
 block discarded – undo
184 183
     {
185 184
         static $cache = [];
186 185
 
187
-        if (! $this->driverIsSql()) {
186
+        if (!$this->driverIsSql()) {
188 187
             return true;
189 188
         }
190 189
 
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/AutoSet.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
             $this->getDbColumnTypes();
17 17
         }
18 18
 
19
-        array_map(function ($field) {
19
+        array_map(function($field) {
20 20
             $new_field = [
21 21
                 'name'       => $field,
22 22
                 'label'      => $this->makeLabel($field),
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
                 'autoset'    => true,
29 29
             ];
30 30
 
31
-            if (! isset($this->fields()[$field])) {
31
+            if (!isset($this->fields()[$field])) {
32 32
                 $this->addField($new_field);
33 33
             }
34 34
 
35
-            if (! in_array($field, $this->model->getHidden()) && ! in_array($field, $this->columns())) {
35
+            if (!in_array($field, $this->model->getHidden()) && !in_array($field, $this->columns())) {
36 36
                 $this->addColumn([
37 37
                     'name'    => $field,
38 38
                     'label'   => $this->makeLabel($field),
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         $dbColumnTypes = $this->getDbColumnTypes();
112 112
 
113
-        if (! isset($dbColumnTypes[$fieldName])) {
113
+        if (!isset($dbColumnTypes[$fieldName])) {
114 114
             return 'text';
115 115
         }
116 116
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $types = ['enum' => 'string'];
169 169
         $platform = $this->getSchema()->getConnection()->getDoctrineConnection()->getDatabasePlatform();
170 170
         foreach ($types as $type_key => $type_value) {
171
-            if (! $platform->hasDoctrineTypeMappingFor($type_key)) {
171
+            if (!$platform->hasDoctrineTypeMappingFor($type_key)) {
172 172
                 $platform->registerDoctrineTypeMapping($type_key, $type_value);
173 173
             }
174 174
         }
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
     {
222 222
         $fillable = $this->model->getFillable();
223 223
 
224
-        if (! $this->driverIsSql()) {
224
+        if (!$this->driverIsSql()) {
225 225
             $columns = $fillable;
226 226
         } else {
227 227
             // Automatically-set columns should be both in the database, and in the $fillable variable on the Eloquent Model
228 228
             $columns = $this->model->getConnection()->getSchemaBuilder()->getColumnListing($this->model->getTable());
229 229
 
230
-            if (! empty($fillable)) {
230
+            if (!empty($fillable)) {
231 231
                 $columns = array_intersect($columns, $fillable);
232 232
             }
233 233
         }
Please login to merge, or discard this patch.
src/app/Http/Controllers/Operations/ListOperation.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $this->crud->allowAccess('list');
43 43
 
44
-        $this->crud->operation('list', function () {
44
+        $this->crud->operation('list', function() {
45 45
             $this->crud->loadDefaultOperationSettingsFromConfig();
46 46
         });
47 47
     }
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
         // if there was an order set, this will be the last one (after all others were applied)
115 115
         $orderBy = $this->crud->query->getQuery()->orders;
116 116
         $hasOrderByPrimaryKey = false;
117
-        collect($orderBy)->each(function ($item, $key) use ($hasOrderByPrimaryKey) {
118
-            if (! isset($item['column'])) {
117
+        collect($orderBy)->each(function($item, $key) use ($hasOrderByPrimaryKey) {
118
+            if (!isset($item['column'])) {
119 119
                 return false;
120 120
             }
121 121
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 return false;
126 126
             }
127 127
         });
128
-        if (! $hasOrderByPrimaryKey) {
128
+        if (!$hasOrderByPrimaryKey) {
129 129
             $this->crud->orderByWithPrefix($this->crud->model->getKeyName(), 'DESC');
130 130
         }
131 131
 
Please login to merge, or discard this patch.
src/app/Models/Traits/HasRelationshipFields.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $table = $instance->getTableWithPrefix();
73 73
 
74 74
         // MongoDB columns are alway nullable
75
-        if (! in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) {
75
+        if (!in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) {
76 76
             return true;
77 77
         }
78 78
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             // check for NOT NULL
83 83
             $notNull = $column->getNotnull();
84 84
             // return the value of nullable (aka the inverse of NOT NULL)
85
-            return ! $notNull;
85
+            return !$notNull;
86 86
         } catch (\Exception $e) {
87 87
             return true;
88 88
         }
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Relationships.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
         return collect($this->fields())
62 62
             ->where('model')
63 63
             ->whereIn('relation_type', $relation_types)
64
-            ->filter(function ($item) {
64
+            ->filter(function($item) {
65 65
                 $related_model = get_class($this->model->{Arr::first(explode('.', $item['entity']))}()->getRelated());
66 66
 
67 67
                 return Str::contains($item['entity'], '.') && $item['model'] !== $related_model ? false : true;
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Update.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
         foreach ($fields as &$field) {
56 56
             // set the value
57
-            if (! isset($field['value'])) {
57
+            if (!isset($field['value'])) {
58 58
                 if (isset($field['subfields'])) {
59 59
                     $field['value'] = [];
60 60
                     foreach ($field['subfields'] as $subfield) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         }
68 68
 
69 69
         // always have a hidden input for the entry id
70
-        if (! array_key_exists('id', $fields)) {
70
+        if (!array_key_exists('id', $fields)) {
71 71
             $fields['id'] = [
72 72
                 'name'  => $entry->getKeyName(),
73 73
                 'value' => $entry->getKey(),
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
             $relation_array = explode('.', $relational_entity);
95 95
 
96
-            $relatedModel = array_reduce(array_splice($relation_array, 0, -1), function ($obj, $method) {
96
+            $relatedModel = array_reduce(array_splice($relation_array, 0, -1), function($obj, $method) {
97 97
                 return $obj->{$method} ? $obj->{$method} : $obj;
98 98
             }, $model);
99 99
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                     case 'HasMany':
111 111
                     case 'MorphMany':
112 112
                         if (isset($field['pivotFields']) && is_array($field['pivotFields'])) {
113
-                            $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) {
113
+                            $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) {
114 114
                                 return $field['name'] != $item['name'];
115 115
                             });
116 116
                             $related_models = $relatedModel->{$relationMethod};
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                         if (isset($field['pivot']) && $field['pivot'] && isset($field['pivotFields']) && is_array($field['pivotFields'])) {
137 137
 
138 138
                             // we remove our current relation from the pivotFields.
139
-                            $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) {
139
+                            $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) {
140 140
                                 return $field['name'] != $item['name'];
141 141
                             });
142 142
 
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Create.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -385,7 +385,7 @@
 block discarded – undo
385 385
         if (! is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) {
386 386
             //we add the new values into the relation
387 387
             $model_instance->whereIn($model_instance->getKeyName(), $relation_values)
388
-           ->update([$relation_foreign_key => $item->{$relation_local_key}]);
388
+            ->update([$relation_foreign_key => $item->{$relation_local_key}]);
389 389
 
390 390
             //we clear up any values that were removed from model relation.
391 391
             //if developer provided a fallback id, we use it
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $all_relation_fields = $this->getRelationFields();
93 93
 
94
-        return Arr::where($all_relation_fields, function ($value, $key) {
94
+        return Arr::where($all_relation_fields, function($value, $key) {
95 95
             return isset($value['pivot']) && $value['pivot'];
96 96
         });
97 97
     }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                             $field_data = json_decode($data[$field['name']], true);
151 151
 
152 152
                             //we grab from the parsed data the specific values for this pivot
153
-                            $pivot_data = Arr::first(Arr::where($field_data, function ($item) use ($pivot_id, $field) {
153
+                            $pivot_data = Arr::first(Arr::where($field_data, function($item) use ($pivot_id, $field) {
154 154
                                 return $item[$field['name']] === $pivot_id;
155 155
                             }));
156 156
 
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
      */
195 195
     private function createRelationsForItem($item, $formattedData)
196 196
     {
197
-        if (! isset($formattedData['relations'])) {
197
+        if (!isset($formattedData['relations'])) {
198 198
             return false;
199 199
         }
200 200
 
201 201
         foreach ($formattedData['relations'] as $relationMethod => $relationData) {
202
-            if (! isset($relationData['model'])) {
202
+            if (!isset($relationData['model'])) {
203 203
                 continue;
204 204
             }
205 205
 
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
                 case 'MorphOne':
212 212
                     // we first check if there are relations of the relation
213 213
                     if (isset($relationData['relations'])) {
214
-                        $belongsToRelations = Arr::where($relationData['relations'], function ($relation_data) {
214
+                        $belongsToRelations = Arr::where($relationData['relations'], function($relation_data) {
215 215
                             return $relation_data['relation_type'] == 'BelongsTo';
216 216
                         });
217 217
                         // adds the values of the BelongsTo relations of this entity to the array of values that will
218 218
                         // be saved at the same time like we do in parent entity belongs to relations
219 219
                         $valuesWithRelations = $this->associateHasOneBelongsTo($belongsToRelations, $relationData['values'], $relation->getModel());
220 220
 
221
-                        $relationData['relations'] = Arr::where($relationData['relations'], function ($item) {
221
+                        $relationData['relations'] = Arr::where($relationData['relations'], function($item) {
222 222
                             return $item['relation_type'] != 'BelongsTo';
223 223
                         });
224 224
 
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
 
232 232
             if ($relation instanceof HasOne || $relation instanceof MorphOne) {
233 233
                 if (isset($relationData['relations'])) {
234
-                    $belongsToRelations = Arr::where($relationData['relations'], function ($relation_data) {
234
+                    $belongsToRelations = Arr::where($relationData['relations'], function($relation_data) {
235 235
                         return $relation_data['relation_type'] == 'BelongsTo';
236 236
                     });
237 237
                     // adds the values of the BelongsTo relations of this entity to the array of values that will
238 238
                     // be saved at the same time like we do in parent entity belongs to relations
239 239
                     $valuesWithRelations = $this->associateHasOneBelongsTo($belongsToRelations, $relationData['values'], $relation->getModel());
240 240
 
241
-                    $relationData['relations'] = Arr::where($relationData['relations'], function ($item) {
241
+                    $relationData['relations'] = Arr::where($relationData['relations'], function($item) {
242 242
                         return $item['relation_type'] != 'BelongsTo';
243 243
                     });
244 244
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     private function getRelationDataFromFormData($data)
298 298
     {
299 299
         // exclude the already attached belongs to relations but include nested belongs to.
300
-        $relation_fields = Arr::where($this->getRelationFields(), function ($field, $key) {
300
+        $relation_fields = Arr::where($this->getRelationFields(), function($field, $key) {
301 301
             return $field['relation_type'] !== 'BelongsTo' || $this->isNestedRelation($field);
302 302
         });
303 303
 
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
             if (isset($relation_field['pivot']) && $relation_field['pivot'] !== true) {
309 309
                 $key = implode('.relations.', explode('.', $this->getOnlyRelationEntity($relation_field)));
310 310
                 $fieldData = Arr::get($relationData, 'relations.'.$key, []);
311
-                if (! array_key_exists('model', $fieldData)) {
311
+                if (!array_key_exists('model', $fieldData)) {
312 312
                     $fieldData['model'] = $relation_field['model'];
313 313
                 }
314
-                if (! array_key_exists('parent', $fieldData)) {
314
+                if (!array_key_exists('parent', $fieldData)) {
315 315
                     $fieldData['parent'] = $this->getRelationModel($attributeKey, -1);
316 316
                 }
317 317
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                 // this allow developers to override that behavior and force deletion from database
326 326
                 $fieldData['force_delete'] = $relation_field['force_delete'] ?? false;
327 327
 
328
-                if (! array_key_exists('relation_type', $fieldData)) {
328
+                if (!array_key_exists('relation_type', $fieldData)) {
329 329
                     $fieldData['relation_type'] = $relation_field['relation_type'];
330 330
                 }
331 331
                 $relatedAttribute = Arr::last(explode('.', $attributeKey));
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 
354 354
         $related_method = Arr::last($entity_array);
355 355
 
356
-        if (! method_exists($relation_model, $related_method)) {
356
+        if (!method_exists($relation_model, $related_method)) {
357 357
             if (count($entity_array) <= 1) {
358 358
                 return $relation_field['entity'];
359 359
             } else {
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 
383 383
         $relation_column_is_nullable = $model_instance->isColumnNullable($relation_foreign_key);
384 384
 
385
-        if (! is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) {
385
+        if (!is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) {
386 386
             //we add the new values into the relation
387 387
             $model_instance->whereIn($model_instance->getKeyName(), $relation_values)
388 388
            ->update([$relation_foreign_key => $item->{$relation_local_key}]);
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                             ->where($relation_foreign_key, $item->{$relation_local_key})
397 397
                             ->update([$relation_foreign_key => $relationData['fallback_id']]);
398 398
             } else {
399
-                if (! $relation_column_is_nullable || $force_delete) {
399
+                if (!$relation_column_is_nullable || $force_delete) {
400 400
                     $model_instance->whereNotIn($model_instance->getKeyName(), $relation_values)
401 401
                             ->where($relation_foreign_key, $item->{$relation_local_key})
402 402
                             ->delete();
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                 $model_instance->where($relation_foreign_key, $item->{$relation_local_key})
414 414
                             ->update([$relation_foreign_key => $relationData['fallback_id']]);
415 415
             } else {
416
-                if (! $relation_column_is_nullable || $force_delete) {
416
+                if (!$relation_column_is_nullable || $force_delete) {
417 417
                     $model_instance->where($relation_foreign_key, $item->{$relation_local_key})->delete();
418 418
                 } else {
419 419
                     $model_instance->where($relation_foreign_key, $item->{$relation_local_key})
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
         if ($items->isEmpty()) {
440 440
             $entry->{$relationMethod}()->sync([]);
441 441
         } else {
442
-            $items->each(function (&$item, $key) use ($relatedModel, $entry, $relationMethod) {
442
+            $items->each(function(&$item, $key) use ($relatedModel, $entry, $relationMethod) {
443 443
                 if (isset($item[$relatedModel->getKeyName()])) {
444 444
                     $entry->{$relationMethod}()->updateOrCreate([$relatedModel->getKeyName() => $item[$relatedModel->getKeyName()]], $item);
445 445
                 } else {
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
 
450 450
             $relatedItemsSent = $items->pluck($relatedModel->getKeyName());
451 451
 
452
-            if (! $relatedItemsSent->isEmpty()) {
452
+            if (!$relatedItemsSent->isEmpty()) {
453 453
                 $itemsInDatabase = $entry->{$relationMethod};
454 454
                 //we perform the cleanup of removed database items
455
-                $itemsInDatabase->each(function ($item, $key) use ($relatedItemsSent) {
456
-                    if (! $relatedItemsSent->contains($item->getKey())) {
455
+                $itemsInDatabase->each(function($item, $key) use ($relatedItemsSent) {
456
+                    if (!$relatedItemsSent->contains($item->getKey())) {
457 457
                         $item->delete();
458 458
                     }
459 459
                 });
Please login to merge, or discard this patch.