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/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/app/Library/CrudPanel/Traits/Search.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function applySearchTerm($searchTerm)
23 23
     {
24
-        return $this->query->where(function ($query) use ($searchTerm) {
24
+        return $this->query->where(function($query) use ($searchTerm) {
25 25
             foreach ($this->columns() as $column) {
26
-                if (! isset($column['type'])) {
26
+                if (!isset($column['type'])) {
27 27
                     abort(400, 'Missing column type when trying to apply search term.');
28 28
                 }
29 29
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
                 case 'select':
83 83
                 case 'select_multiple':
84
-                    $query->orWhereHas($column['entity'], function ($q) use ($column, $searchTerm) {
84
+                    $query->orWhereHas($column['entity'], function($q) use ($column, $searchTerm) {
85 85
                         $q->where($this->getColumnWithTableNamePrefixed($q, $column['attribute']), 'like', '%'.$searchTerm.'%');
86 86
                     });
87 87
                     break;
@@ -270,13 +270,13 @@  discard block
 block discarded – undo
270 270
         if (isset($column['type'])) {
271 271
             // create a list of paths to column blade views
272 272
             // including the configured view_namespaces
273
-            $columnPaths = array_map(function ($item) use ($column) {
273
+            $columnPaths = array_map(function($item) use ($column) {
274 274
                 return $item.'.'.$column['type'];
275 275
             }, config('backpack.crud.view_namespaces.columns'));
276 276
 
277 277
             // but always fall back to the stock 'text' column
278 278
             // if a view doesn't exist
279
-            if (! in_array('crud::columns.text', $columnPaths)) {
279
+            if (!in_array('crud::columns.text', $columnPaths)) {
280 280
                 $columnPaths[] = 'crud::columns.text';
281 281
             }
282 282
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
      */
304 304
     private function renderCellView($view, $column, $entry, $rowNumber = false)
305 305
     {
306
-        if (! view()->exists($view)) {
306
+        if (!view()->exists($view)) {
307 307
             $view = 'crud::columns.text'; // fallback to text column
308 308
         }
309 309
 
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/CrudPanel/CrudFilter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function wasNotApplied()
86 86
     {
87
-        return ! $this->applied;
87
+        return !$this->applied;
88 88
     }
89 89
 
90 90
     /**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
         $input = $input ?? new ParameterBag($this->crud()->getRequest()->all());
107 107
 
108
-        if (! $input->has($this->name)) {
108
+        if (!$input->has($this->name)) {
109 109
             // if fallback logic was supplied and is a closure
110 110
             if (is_callable($this->fallbackLogic)) {
111 111
                 return ($this->fallbackLogic)();
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $type = $this->type;
144 144
 
145
-        return array_map(function ($item) use ($type) {
145
+        return array_map(function($item) use ($type) {
146 146
             return $item.'.'.$type;
147 147
         }, config('backpack.crud.view_namespaces.filters'));
148 148
     }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      */
305 305
     public function values($value)
306 306
     {
307
-        $this->values = (! is_string($value) && is_callable($value)) ? $value() : $value;
307
+        $this->values = (!is_string($value) && is_callable($value)) ? $value() : $value;
308 308
 
309 309
         return $this->save();
310 310
     }
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.
src/app/Library/CrudPanel/Traits/Relationships.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $model = $this->getRelationModel($field['entity'], -1);
65 65
         $lastSegmentAfterDot = Str::of($field['entity'])->afterLast('.');
66 66
 
67
-        if (! method_exists($model, $lastSegmentAfterDot)) {
67
+        if (!method_exists($model, $lastSegmentAfterDot)) {
68 68
             return (string) Str::of($field['entity'])->beforeLast('.');
69 69
         }
70 70
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
         return collect($this->getCleanStateFields())
87 87
             ->whereIn('relation_type', $relation_types)
88
-            ->filter(function ($item) use ($nested) {
88
+            ->filter(function($item) use ($nested) {
89 89
                 if ($nested) {
90 90
                     return true;
91 91
                 }
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
      */
130 130
     private function getRelationFieldsWithoutRelationType($relations, $include_nested = false)
131 131
     {
132
-        if (! is_array($relations)) {
132
+        if (!is_array($relations)) {
133 133
             $relations = [$relations];
134 134
         }
135 135
 
136 136
         $fields = $this->getRelationFields();
137 137
 
138 138
         foreach ($relations as $relation) {
139
-            $fields = array_filter($fields, function ($field) use ($relation, $include_nested) {
139
+            $fields = array_filter($fields, function($field) use ($relation, $include_nested) {
140 140
                 if ($include_nested) {
141 141
                     return $field['relation_type'] !== $relation || ($field['relation_type'] === $relation && Str::contains($field['name'], '.'));
142 142
                 }
@@ -221,8 +221,8 @@  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) {
225
-            return isset($value['pivot']) && ! $value['pivot'];
224
+        return Arr::where($all_relation_fields, function($value, $key) {
225
+            return isset($value['pivot']) && !$value['pivot'];
226 226
         });
227 227
     }
228 228
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     {
236 236
         $all_relation_fields = $this->getRelationFields();
237 237
 
238
-        return Arr::where($all_relation_fields, function ($value, $key) {
238
+        return Arr::where($all_relation_fields, function($value, $key) {
239 239
             return isset($value['pivot']) && $value['pivot'];
240 240
         });
241 241
     }
Please login to merge, or discard this patch.