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 (#4113)
by Cristian
13:41
created
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/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/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/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.
tests/Unit/CrudPanel/CrudPanelCreateTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -596,7 +596,7 @@
 block discarded – undo
596 596
                 'nickname' => 'i_have_has_one',
597 597
                 'profile_picture' => 'ohh my picture 1.jpg',
598 598
                 'article' => 1,
599
-                'addresses' => [ // HasOne is tested in other test function
599
+                'addresses' => [// HasOne is tested in other test function
600 600
                     [
601 601
                         'city' => 'test',
602 602
                         'street' => 'test',
Please login to merge, or discard this patch.
database/migrations/2020_03_31_114745_create_pivotable_relations_tables.php 1 patch
Spacing   +13 added lines, -13 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,54 +44,54 @@  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
         });
82 82
 
83
-        Schema::create('bangs', function (Blueprint $table) {
83
+        Schema::create('bangs', function(Blueprint $table) {
84 84
             $table->bigIncrements('id');
85 85
             $table->string('name');
86 86
         });
87 87
 
88
-        Schema::create('account_details_bang', function (Blueprint $table) {
88
+        Schema::create('account_details_bang', function(Blueprint $table) {
89 89
             $table->bigIncrements('id');
90 90
             $table->bigInteger('account_details_id');
91 91
             $table->bigInteger('bang_id');
92 92
         });
93 93
 
94
-        Schema::create('account_details_bangs_pivot', function (Blueprint $table) {
94
+        Schema::create('account_details_bangs_pivot', function(Blueprint $table) {
95 95
             $table->bigIncrements('id');
96 96
             $table->bigInteger('account_details_id');
97 97
             $table->bigInteger('bang_id');
Please login to merge, or discard this patch.