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
29:04 queued 13:44
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/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   +18 added lines, -18 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::class:
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
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     private function getRelationDataFromFormData($data)
290 290
     {
291 291
         // exclude the already attached belongs to relations but include nested belongs to.
292
-        $relation_fields = Arr::where($this->getRelationFields(), function ($field, $key) {
292
+        $relation_fields = Arr::where($this->getRelationFields(), function($field, $key) {
293 293
             return $field['relation_type'] !== 'BelongsTo' || $this->isNestedRelation($field);
294 294
         });
295 295
 
@@ -300,10 +300,10 @@  discard block
 block discarded – undo
300 300
             if (isset($relation_field['pivot']) && $relation_field['pivot'] !== true) {
301 301
                 $key = implode('.relations.', explode('.', $this->getOnlyRelationEntity($relation_field)));
302 302
                 $fieldData = Arr::get($relationData, 'relations.'.$key, []);
303
-                if (! array_key_exists('model', $fieldData)) {
303
+                if (!array_key_exists('model', $fieldData)) {
304 304
                     $fieldData['model'] = $relation_field['model'];
305 305
                 }
306
-                if (! array_key_exists('parent', $fieldData)) {
306
+                if (!array_key_exists('parent', $fieldData)) {
307 307
                     $fieldData['parent'] = $this->getRelationModel($attributeKey, -1);
308 308
                 }
309 309
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                 // this allow developers to override that behavior and force deletion from database
318 318
                 $fieldData['force_delete'] = $relation_field['force_delete'] ?? false;
319 319
 
320
-                if (! array_key_exists('relation_type', $fieldData)) {
320
+                if (!array_key_exists('relation_type', $fieldData)) {
321 321
                     $fieldData['relation_type'] = $relation_field['relation_type'];
322 322
                 }
323 323
                 $relatedAttribute = Arr::last(explode('.', $attributeKey));
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 
346 346
         $related_method = Arr::last($entity_array);
347 347
 
348
-        if (! method_exists($relation_model, $related_method)) {
348
+        if (!method_exists($relation_model, $related_method)) {
349 349
             if (count($entity_array) <= 1) {
350 350
                 return $relation_field['entity'];
351 351
             } else {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
         $relation_column_is_nullable = $model_instance->isColumnNullable($relation_foreign_key);
376 376
 
377
-        if (! is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) {
377
+        if (!is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) {
378 378
             //we add the new values into the relation
379 379
             $model_instance->whereIn($model_instance->getKeyName(), $relation_values)
380 380
            ->update([$relation_foreign_key => $item->{$relation_local_key}]);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
                             ->where($relation_foreign_key, $item->{$relation_local_key})
389 389
                             ->update([$relation_foreign_key => $relationData['fallback_id']]);
390 390
             } else {
391
-                if (! $relation_column_is_nullable || $force_delete) {
391
+                if (!$relation_column_is_nullable || $force_delete) {
392 392
                     $model_instance->whereNotIn($model_instance->getKeyName(), $relation_values)
393 393
                             ->where($relation_foreign_key, $item->{$relation_local_key})
394 394
                             ->delete();
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                 $model_instance->where($relation_foreign_key, $item->{$relation_local_key})
406 406
                             ->update([$relation_foreign_key => $relationData['fallback_id']]);
407 407
             } else {
408
-                if (! $relation_column_is_nullable || $force_delete) {
408
+                if (!$relation_column_is_nullable || $force_delete) {
409 409
                     $model_instance->where($relation_foreign_key, $item->{$relation_local_key})->delete();
410 410
                 } else {
411 411
                     $model_instance->where($relation_foreign_key, $item->{$relation_local_key})
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
         if ($items->isEmpty()) {
432 432
             $entry->{$relationMethod}()->sync([]);
433 433
         } else {
434
-            $items->each(function (&$item, $key) use ($relatedModel, $entry, $relationMethod) {
434
+            $items->each(function(&$item, $key) use ($relatedModel, $entry, $relationMethod) {
435 435
                 if (isset($item[$relatedModel->getKeyName()])) {
436 436
                     $entry->{$relationMethod}()->updateOrCreate([$relatedModel->getKeyName() => $item[$relatedModel->getKeyName()]], $item);
437 437
                 } else {
@@ -441,10 +441,10 @@  discard block
 block discarded – undo
441 441
 
442 442
             $relatedItemsSent = $items->pluck($relatedModel->getKeyName());
443 443
 
444
-            if (! $relatedItemsSent->isEmpty()) {
444
+            if (!$relatedItemsSent->isEmpty()) {
445 445
                 //we perform the cleanup of removed database items
446
-                $entry->{$relationMethod}->each(function ($item, $key) use ($relatedItemsSent) {
447
-                    if (! $relatedItemsSent->contains($item->getKey())) {
446
+                $entry->{$relationMethod}->each(function($item, $key) use ($relatedItemsSent) {
447
+                    if (!$relatedItemsSent->contains($item->getKey())) {
448 448
                         $item->delete();
449 449
                     }
450 450
                 });
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
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         foreach ($fields as &$field) {
62 62
             // set the value
63
-            if (! isset($field['value'])) {
63
+            if (!isset($field['value'])) {
64 64
                 if (isset($field['subfields'])) {
65 65
                     $field['value'] = [];
66 66
                     foreach ($field['subfields'] as $subfield) {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         }
74 74
 
75 75
         // always have a hidden input for the entry id
76
-        if (! array_key_exists('id', $fields)) {
76
+        if (!array_key_exists('id', $fields)) {
77 77
             $fields['id'] = [
78 78
                 'name'  => $entry->getKeyName(),
79 79
                 'value' => $entry->getKey(),
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
             $relation_array = explode('.', $relational_entity);
101 101
 
102
-            $relatedModel = array_reduce(array_splice($relation_array, 0, -1), function ($obj, $method) {
102
+            $relatedModel = array_reduce(array_splice($relation_array, 0, -1), function($obj, $method) {
103 103
                 return $obj->{$method} ? $obj->{$method} : $obj;
104 104
             }, $model);
105 105
 
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
      */
162 162
     private function getManyRelationAttributeValue($model, $relation_method, $field)
163 163
     {
164
-        if (! isset($field['pivotFields']) || ! is_array($field['pivotFields'])) {
164
+        if (!isset($field['pivotFields']) || !is_array($field['pivotFields'])) {
165 165
             return false;
166 166
         }
167 167
 
168
-        $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) {
168
+        $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) {
169 169
             return $field['name'] != $item['name'];
170 170
         });
171 171
         $related_models = $model->{$relation_method};
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
     private function getToManyRelationAttributeValue($model, $relation_method, $field)
197 197
     {
198 198
         // if pivot is true and there are `pivotFields` we need to get those pivot values to show on the edit page
199
-        if (! isset($field['pivot']) || ! isset($field['pivotFields']) || ! is_array($field['pivotFields'])) {
199
+        if (!isset($field['pivot']) || !isset($field['pivotFields']) || !is_array($field['pivotFields'])) {
200 200
             return false;
201 201
         }
202 202
 
203 203
         // we remove our current relation from the pivotFields.
204
-        $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) {
204
+        $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) {
205 205
             return $field['name'] != $item['name'];
206 206
         });
207 207
 
Please login to merge, or discard this patch.