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

Completed
Pull Request — master (#1717)
by
unknown
03:41
created
src/PanelTraits/FakeFields.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
                 $fakeFieldKey = isset($field['store_in']) ? $field['store_in'] : 'extras';
30 30
                 $this->addCompactedField($requestInput, $field['name'], $fakeFieldKey);
31 31
 
32
-                if (! in_array($fakeFieldKey, $compactedFakeFields)) {
32
+                if (!in_array($fakeFieldKey, $compactedFakeFields)) {
33 33
                     $compactedFakeFields[] = $fakeFieldKey;
34 34
                 }
35 35
             }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
         // json_encode all fake_value columns if applicable in the database, so they can be properly stored and interpreted
39 39
         foreach ($compactedFakeFields as $value) {
40
-            if (! (property_exists($this->model, 'translatable') && in_array($value, $this->model->getTranslatableAttributes(), true)) && $this->model->shouldEncodeFake($value)) {
40
+            if (!(property_exists($this->model, 'translatable') && in_array($value, $this->model->getTranslatableAttributes(), true)) && $this->model->shouldEncodeFake($value)) {
41 41
                 $requestInput[$value] = json_encode($requestInput[$value]);
42 42
             }
43 43
         }
Please login to merge, or discard this patch.
src/PanelTraits/AutoSet.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $this->setDoctrineTypesMapping();
23 23
         $this->getDbColumnTypes();
24 24
 
25
-        array_map(function ($field) {
25
+        array_map(function($field) {
26 26
             $new_field = [
27 27
                 'name'       => $field,
28 28
                 'label'      => $this->makeLabel($field),
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
                 'attributes' => [],
34 34
                 'autoset'    => true,
35 35
             ];
36
-            if (! isset($this->create_fields[$field])) {
36
+            if (!isset($this->create_fields[$field])) {
37 37
                 $this->create_fields[$field] = $new_field;
38 38
             }
39
-            if (! isset($this->update_fields[$field])) {
39
+            if (!isset($this->update_fields[$field])) {
40 40
                 $this->update_fields[$field] = $new_field;
41 41
             }
42 42
 
43
-            if (! in_array($field, $this->model->getHidden()) && ! isset($this->columns[$field])) {
43
+            if (!in_array($field, $this->model->getHidden()) && !isset($this->columns[$field])) {
44 44
                 $this->addColumn([
45 45
                     'name'  => $field,
46 46
                     'label' => $this->makeLabel($field),
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function getFieldTypeFromDbColumnType($field)
82 82
     {
83
-        if (! array_key_exists($field, $this->db_column_types)) {
83
+        if (!array_key_exists($field, $this->db_column_types)) {
84 84
             return 'text';
85 85
         }
86 86
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         $types = ['enum' => 'string'];
148 148
         $platform = \DB::getDoctrineConnection()->getDatabasePlatform();
149 149
         foreach ($types as $type_key => $type_value) {
150
-            if (! $platform->hasDoctrineTypeMappingFor($type_key)) {
150
+            if (!$platform->hasDoctrineTypeMappingFor($type_key)) {
151 151
                 $platform->registerDoctrineTypeMapping($type_key, $type_value);
152 152
             }
153 153
         }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $columns = $this->model->getConnection()->getSchemaBuilder()->getColumnListing($this->model->getTable());
203 203
         $fillable = $this->model->getFillable();
204 204
 
205
-        if (! empty($fillable)) {
205
+        if (!empty($fillable)) {
206 206
             $columns = array_intersect($columns, $fillable);
207 207
         }
208 208
 
Please login to merge, or discard this patch.
src/app/Console/Commands/Install.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace Backpack\CRUD\app\Console\Commands;
4 4
 
5
-use Illuminate\Console\Command;
6
-use Symfony\Component\Process\Process;
7 5
 use Backpack\Base\app\Console\Commands\Install as BaseInstall;
8 6
 
9 7
 class Install extends BaseInstall
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
                     $this->executeProcess('mkdir -p public/uploads');
54 54
                     break;
55 55
                 case '\\': // windows
56
-                    if (! file_exists('public\uploads')) {
56
+                    if (!file_exists('public\uploads')) {
57 57
                         $this->executeProcess('mkdir public\uploads');
58 58
                     }
59 59
                     break;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     /**
31 31
      * Execute the console command.
32 32
      *
33
-     * @return mixed
33
+     * @return false|null
34 34
      */
35 35
     public function handle()
36 36
     {
Please login to merge, or discard this patch.
src/PanelTraits/Create.php 3 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Backpack\CRUD\PanelTraits;
4 4
 
5
-use Illuminate\Database\Eloquent\Relations\HasOne;
6 5
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
6
+use Illuminate\Database\Eloquent\Relations\HasOne;
7 7
 
8 8
 trait Create
9 9
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $all_relation_fields = $this->getRelationFields($form);
92 92
 
93
-        return array_where($all_relation_fields, function ($value, $key) {
93
+        return array_where($all_relation_fields, function($value, $key) {
94 94
             return isset($value['pivot']) && $value['pivot'];
95 95
         });
96 96
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     private function createRelationsForItem($item, $formattedData)
163 163
     {
164
-        if (! isset($formattedData['relations'])) {
164
+        if (!isset($formattedData['relations'])) {
165 165
             return false;
166 166
         }
167 167
 
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
                 $key = implode('.relations.', explode('.', $relationField['entity']));
220 220
                 $fieldData = array_get($relationData, 'relations.'.$key, []);
221 221
 
222
-                if (! array_key_exists('model', $fieldData)) {
222
+                if (!array_key_exists('model', $fieldData)) {
223 223
                     $fieldData['model'] = $relationField['model'];
224 224
                 }
225 225
 
226
-                if (! array_key_exists('parent', $fieldData)) {
226
+                if (!array_key_exists('parent', $fieldData)) {
227 227
                     $fieldData['parent'] = $this->getRelationModel($relationField['entity'], -1);
228 228
                 }
229 229
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@
 block discarded – undo
159 159
      * @param \Illuminate\Database\Eloquent\Model $item          The current CRUD model.
160 160
      * @param array                               $formattedData The form data.
161 161
      *
162
-     * @return bool|null
162
+     * @return false|null
163 163
      */
164 164
     private function createRelationsForItem($item, $formattedData)
165 165
     {
Please login to merge, or discard this patch.
src/CrudPanel.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function setModel($model_namespace)
90 90
     {
91
-        if (! class_exists($model_namespace)) {
91
+        if (!class_exists($model_namespace)) {
92 92
             throw new \Exception('This model does not exist.', 404);
93 93
         }
94 94
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     {
139 139
         $complete_route = $route.'.index';
140 140
 
141
-        if (! \Route::has($complete_route)) {
141
+        if (!\Route::has($complete_route)) {
142 142
             throw new \Exception('There are no routes for this route name.', 404);
143 143
         }
144 144
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     public function getFirstOfItsTypeInArray($type, $array)
190 190
     {
191
-        return array_first($array, function ($item) use ($type) {
191
+        return array_first($array, function($item) use ($type) {
192 192
             return $item['type'] == $type;
193 193
         });
194 194
     }
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 
206 206
     public function sync($type, $fields, $attributes)
207 207
     {
208
-        if (! empty($this->{$type})) {
209
-            $this->{$type} = array_map(function ($field) use ($fields, $attributes) {
208
+        if (!empty($this->{$type})) {
209
+            $this->{$type} = array_map(function($field) use ($fields, $attributes) {
210 210
                 if (in_array($field['name'], (array) $fields)) {
211 211
                     $field = array_merge($field, $attributes);
212 212
                 }
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
                 }
239 239
             }
240 240
 
241
-            return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function ($item) use ($items) {
242
-                return ! in_array($item['name'], $this->sort[$items]);
241
+            return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use ($items) {
242
+                return !in_array($item['name'], $this->sort[$items]);
243 243
             }));
244 244
         }
245 245
 
@@ -268,15 +268,15 @@  discard block
 block discarded – undo
268 268
     {
269 269
         $relationArray = explode('.', $relationString);
270 270
 
271
-        if (! isset($length)) {
271
+        if (!isset($length)) {
272 272
             $length = count($relationArray);
273 273
         }
274 274
 
275
-        if (! isset($model)) {
275
+        if (!isset($model)) {
276 276
             $model = $this->model;
277 277
         }
278 278
 
279
-        $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) {
279
+        $result = array_reduce(array_splice($relationArray, 0, $length), function($obj, $method) {
280 280
             return $obj->$method()->getRelated();
281 281
         }, $model);
282 282
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         $relation = $model->{$firstRelationName};
324 324
 
325 325
         $results = [];
326
-        if (! empty($relation)) {
326
+        if (!empty($relation)) {
327 327
             if ($relation instanceof Collection) {
328 328
                 $currentResults = $relation->toArray();
329 329
             } else {
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
             array_shift($relationArray);
334 334
 
335
-            if (! empty($relationArray)) {
335
+            if (!empty($relationArray)) {
336 336
                 foreach ($currentResults as $currentResult) {
337 337
                     $results = array_merge($results, $this->getRelationModelInstances($currentResult, implode('.', $relationArray)));
338 338
                 }
Please login to merge, or discard this patch.
Unused Use Statements   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,28 +2,28 @@
 block discarded – undo
2 2
 
3 3
 namespace Backpack\CRUD;
4 4
 
5
-use Backpack\CRUD\PanelTraits\Read;
6
-use Backpack\CRUD\PanelTraits\Tabs;
7
-use Backpack\CRUD\PanelTraits\Query;
8
-use Backpack\CRUD\PanelTraits\Views;
9 5
 use Backpack\CRUD\PanelTraits\Access;
6
+use Backpack\CRUD\PanelTraits\AutoFocus;
7
+use Backpack\CRUD\PanelTraits\AutoSet;
8
+use Backpack\CRUD\PanelTraits\Buttons;
9
+use Backpack\CRUD\PanelTraits\Columns;
10 10
 use Backpack\CRUD\PanelTraits\Create;
11 11
 use Backpack\CRUD\PanelTraits\Delete;
12 12
 use Backpack\CRUD\PanelTraits\Errors;
13
+use Backpack\CRUD\PanelTraits\FakeColumns;
14
+use Backpack\CRUD\PanelTraits\FakeFields;
13 15
 use Backpack\CRUD\PanelTraits\Fields;
14
-use Backpack\CRUD\PanelTraits\Search;
15
-use Backpack\CRUD\PanelTraits\Update;
16
-use Backpack\CRUD\PanelTraits\AutoSet;
17
-use Backpack\CRUD\PanelTraits\Buttons;
18
-use Backpack\CRUD\PanelTraits\Columns;
19 16
 use Backpack\CRUD\PanelTraits\Filters;
17
+use Backpack\CRUD\PanelTraits\Query;
18
+use Backpack\CRUD\PanelTraits\Read;
20 19
 use Backpack\CRUD\PanelTraits\Reorder;
21
-use Backpack\CRUD\PanelTraits\AutoFocus;
22
-use Backpack\CRUD\PanelTraits\FakeFields;
23
-use Backpack\CRUD\PanelTraits\FakeColumns;
24
-use Illuminate\Database\Eloquent\Collection;
25 20
 use Backpack\CRUD\PanelTraits\RequiredFields;
21
+use Backpack\CRUD\PanelTraits\Search;
22
+use Backpack\CRUD\PanelTraits\Tabs;
23
+use Backpack\CRUD\PanelTraits\Update;
24
+use Backpack\CRUD\PanelTraits\Views;
26 25
 use Backpack\CRUD\PanelTraits\ViewsAndRestoresRevisions;
26
+use Illuminate\Database\Eloquent\Collection;
27 27
 
28 28
 class CrudPanel
29 29
 {
Please login to merge, or discard this patch.
src/PanelTraits/Update.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
         foreach ($fields as &$field) {
53 53
             // set the value
54
-            if (! isset($field['value'])) {
54
+            if (!isset($field['value'])) {
55 55
                 if (isset($field['subfields'])) {
56 56
                     $field['value'] = [];
57 57
                     foreach ($field['subfields'] as $subfield) {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         }
65 65
 
66 66
         // always have a hidden input for the entry id
67
-        if (! array_key_exists('id', $fields)) {
67
+        if (!array_key_exists('id', $fields)) {
68 68
             $fields['id'] = [
69 69
                 'name'  => $entry->getKeyName(),
70 70
                 'value' => $entry->getKey(),
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     {
88 88
         if (isset($field['entity'])) {
89 89
             $relationArray = explode('.', $field['entity']);
90
-            $relatedModel = array_reduce(array_splice($relationArray, 0, -1), function ($obj, $method) {
90
+            $relatedModel = array_reduce(array_splice($relationArray, 0, -1), function($obj, $method) {
91 91
                 return $obj->{$method} ? $obj->{$method} : $obj;
92 92
             }, $model);
93 93
 
Please login to merge, or discard this patch.
src/resources/views/fields/select.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
     <label>{!! $field['label'] !!}</label>
6 6
     @include('crud::inc.field_translatable_icon')
7 7
 
8
-    <?php $entity_model = $crud->getRelationModel($field['entity'],  - 1); ?>
8
+    <?php $entity_model = $crud->getRelationModel($field['entity'], - 1); ?>
9 9
     <select
10 10
         name="{{ $field['name'] }}"
11 11
         @include('crud::inc.field_attributes')
Please login to merge, or discard this patch.
src/resources/views/filters/range.blade.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
 
8 8
 			<div class="form-group backpack-filter m-b-0">
9 9
 					<?php
10
-						$from = '';
11
-						$to = '';
12
-						if($filter->currentValue) {
13
-							$range = (array)json_decode($filter->currentValue);
14
-							$from = $range['from'];
15
-							$to = $range['to'];
16
-						}
17
-					?>
10
+                        $from = '';
11
+                        $to = '';
12
+                        if($filter->currentValue) {
13
+                            $range = (array)json_decode($filter->currentValue);
14
+                            $from = $range['from'];
15
+                            $to = $range['to'];
16
+                        }
17
+                    ?>
18 18
 					<div class="input-group">
19 19
 				        <input class="form-control pull-right from"
20 20
 				        		type="number"
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 					<?php
10 10
 						$from = '';
11 11
 						$to = '';
12
-						if($filter->currentValue) {
13
-							$range = (array)json_decode($filter->currentValue);
12
+						if ($filter->currentValue) {
13
+							$range = (array) json_decode($filter->currentValue);
14 14
 							$from = $range['from'];
15 15
 							$to = $range['to'];
16 16
 						}
Please login to merge, or discard this patch.
src/PanelTraits/Fields.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -167,18 +167,18 @@
 block discarded – undo
167 167
     {
168 168
         foreach ($modifications as $key => $newValue) {
169 169
             switch (strtolower($form)) {
170
-          case 'create':
170
+            case 'create':
171 171
               $this->create_fields[$field][$key] = $newValue;
172
-              break;
172
+                break;
173 173
 
174
-          case 'update':
174
+            case 'update':
175 175
               $this->update_fields[$field][$key] = $newValue;
176
-              break;
176
+                break;
177 177
 
178
-          default:
178
+            default:
179 179
               $this->create_fields[$field][$key] = $newValue;
180
-              $this->update_fields[$field][$key] = $newValue;
181
-              break;
180
+                $this->update_fields[$field][$key] = $newValue;
181
+                break;
182 182
         }
183 183
         }
184 184
     }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,28 +26,28 @@  discard block
 block discarded – undo
26 26
 
27 27
         // if this is a relation type field and no corresponding model was specified, get it from the relation method
28 28
         // defined in the main model
29
-        if (isset($completeFieldsArray['entity']) && ! isset($completeFieldsArray['model'])) {
29
+        if (isset($completeFieldsArray['entity']) && !isset($completeFieldsArray['model'])) {
30 30
             $completeFieldsArray['model'] = $this->getRelationModel($completeFieldsArray['entity']);
31 31
         }
32 32
 
33 33
         // if the label is missing, we should set it
34
-        if (! isset($completeFieldsArray['label'])) {
34
+        if (!isset($completeFieldsArray['label'])) {
35 35
             $completeFieldsArray['label'] = ucfirst($completeFieldsArray['name']);
36 36
         }
37 37
 
38 38
         // if the field type is missing, we should set it
39
-        if (! isset($completeFieldsArray['type'])) {
39
+        if (!isset($completeFieldsArray['type'])) {
40 40
             $completeFieldsArray['type'] = $this->getFieldTypeFromDbColumnType($completeFieldsArray['name']);
41 41
         }
42 42
 
43 43
         // if a tab was mentioned, we should enable it
44 44
         if (isset($completeFieldsArray['tab'])) {
45
-            if (! $this->tabsEnabled()) {
45
+            if (!$this->tabsEnabled()) {
46 46
                 $this->enableTabs();
47 47
             }
48 48
         }
49 49
 
50
-        $this->transformFields($form, function ($fields) use ($completeFieldsArray) {
50
+        $this->transformFields($form, function($fields) use ($completeFieldsArray) {
51 51
             $fields[$completeFieldsArray['name']] = $completeFieldsArray;
52 52
 
53 53
             return $fields;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function afterField($targetFieldName, $form = 'both')
81 81
     {
82
-        $this->transformFields($form, function ($fields) use ($targetFieldName) {
82
+        $this->transformFields($form, function($fields) use ($targetFieldName) {
83 83
             return $this->moveField($fields, $targetFieldName, false);
84 84
         });
85 85
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function beforeField($targetFieldName, $form = 'both')
94 94
     {
95
-        $this->transformFields($form, function ($fields) use ($targetFieldName) {
95
+        $this->transformFields($form, function($fields) use ($targetFieldName) {
96 96
             return $this->moveField($fields, $targetFieldName, true);
97 97
         });
98 98
     }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function removeField($name, $form = 'both')
136 136
     {
137
-        $this->transformFields($form, function ($fields) use ($name) {
137
+        $this->transformFields($form, function($fields) use ($name) {
138 138
             array_forget($fields, $name);
139 139
 
140 140
             return $fields;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function removeFields($array_of_names, $form = 'both')
151 151
     {
152
-        if (! empty($array_of_names)) {
152
+        if (!empty($array_of_names)) {
153 153
             foreach ($array_of_names as $name) {
154 154
                 $this->removeField($name, $form);
155 155
             }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     public function removeAllFields($form = 'both')
165 165
     {
166 166
         $current_fields = $this->getCurrentFields();
167
-        if (! empty($current_fields)) {
167
+        if (!empty($current_fields)) {
168 168
             foreach ($current_fields as $field) {
169 169
                 $this->removeField($field['name'], $form);
170 170
             }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                 $jsonCastables = ['array', 'object', 'json'];
228 228
                 $fieldCasting = $casted_attributes[$field['name']];
229 229
 
230
-                if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && ! empty($data[$field['name']]) && ! is_array($data[$field['name']])) {
230
+                if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && !empty($data[$field['name']]) && !is_array($data[$field['name']])) {
231 231
                     try {
232 232
                         $data[$field['name']] = json_decode($data[$field['name']]);
233 233
                     } catch (\Exception $e) {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function orderFields($order, $form = 'both')
260 260
     {
261
-        $this->transformFields($form, function ($fields) use ($order) {
261
+        $this->transformFields($form, function($fields) use ($order) {
262 262
             return $this->applyOrderToFields($fields, $order);
263 263
         });
264 264
     }
Please login to merge, or discard this patch.