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 (#1975)
by Eduard
03:16
created
src/PanelTraits/Filters.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function filtersEnabled()
13 13
     {
14
-        return ! is_array($this->filters);
14
+        return !is_array($this->filters);
15 15
     }
16 16
 
17 17
     /**
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $this->enableFilters();
60 60
 
61 61
         // check if another filter with the same name exists
62
-        if (! isset($options['name'])) {
62
+        if (!isset($options['name'])) {
63 63
             abort(500, 'All your filters need names.');
64 64
         }
65 65
         if ($this->filters->contains('name', $options['name'])) {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     {
161 161
         $filter = $this->filters->firstWhere('name', $name);
162 162
 
163
-        if (! $filter) {
163
+        if (!$filter) {
164 164
             abort(500, 'CRUD Filter "'.$name.'" not found. Please check the filter exists before you modify it.');
165 165
         }
166 166
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
     public function removeFilter($name)
177 177
     {
178
-        $this->filters = $this->filters->reject(function ($filter) use ($name) {
178
+        $this->filters = $this->filters->reject(function($filter) use ($name) {
179 179
             return $filter->name == $name;
180 180
         });
181 181
     }
@@ -259,16 +259,16 @@  discard block
 block discarded – undo
259 259
 
260 260
     public function checkOptionsIntegrity($options)
261 261
     {
262
-        if (! isset($options['name'])) {
262
+        if (!isset($options['name'])) {
263 263
             abort(500, 'Please make sure all your filters have names.');
264 264
         }
265
-        if (! isset($options['type'])) {
265
+        if (!isset($options['type'])) {
266 266
             abort(500, 'Please make sure all your filters have types.');
267 267
         }
268
-        if (! \View::exists('crud::filters.'.$options['type'])) {
268
+        if (!\View::exists('crud::filters.'.$options['type'])) {
269 269
             abort(500, 'No filter view named "'.$options['type'].'.blade.php" was found.');
270 270
         }
271
-        if (! isset($options['label'])) {
271
+        if (!isset($options['label'])) {
272 272
             abort(500, 'Please make sure all your filters have labels.');
273 273
         }
274 274
     }
Please login to merge, or discard this patch.
src/PanelTraits/Tabs.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function tabsDisabled()
37 37
     {
38
-        return ! $this->tabsEnabled;
38
+        return !$this->tabsEnabled;
39 39
     }
40 40
 
41 41
     public function setTabsType($type)
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
     {
117 117
         $all_fields = $this->getCurrentFields();
118 118
 
119
-        $fields_without_a_tab = collect($all_fields)->filter(function ($value, $key) {
120
-            return ! isset($value['tab']);
119
+        $fields_without_a_tab = collect($all_fields)->filter(function($value, $key) {
120
+            return !isset($value['tab']);
121 121
         });
122 122
 
123 123
         return $fields_without_a_tab;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         if ($this->tabExists($label)) {
134 134
             $all_fields = $this->getCurrentFields();
135 135
 
136
-            $fields_for_current_tab = collect($all_fields)->filter(function ($value, $key) use ($label) {
136
+            $fields_for_current_tab = collect($all_fields)->filter(function($value, $key) use ($label) {
137 137
                 return isset($value['tab']) && $value['tab'] == $label;
138 138
             });
139 139
 
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
         $fields = $this->getCurrentFields();
153 153
 
154 154
         $fields_with_tabs = collect($fields)
155
-            ->filter(function ($value, $key) {
155
+            ->filter(function($value, $key) {
156 156
                 return isset($value['tab']);
157 157
             })
158
-            ->each(function ($value, $key) use (&$tabs) {
159
-                if (! in_array($value['tab'], $tabs)) {
158
+            ->each(function($value, $key) use (&$tabs) {
159
+                if (!in_array($value['tab'], $tabs)) {
160 160
                     $tabs[] = $value['tab'];
161 161
                 }
162 162
             });
Please login to merge, or discard this patch.
src/CrudPanel.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function setModel($model_namespace)
92 92
     {
93
-        if (! class_exists($model_namespace)) {
93
+        if (!class_exists($model_namespace)) {
94 94
             throw new \Exception('The model does not exist.', 500);
95 95
         }
96 96
 
97
-        if (! method_exists($model_namespace, 'hasCrudTrait')) {
97
+        if (!method_exists($model_namespace, 'hasCrudTrait')) {
98 98
             throw new \Exception('Please use CrudTrait on the model.', 500);
99 99
         }
100 100
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $complete_route = $route.'.index';
149 149
 
150
-        if (! \Route::has($complete_route)) {
150
+        if (!\Route::has($complete_route)) {
151 151
             throw new \Exception('There are no routes for this route name.', 404);
152 152
         }
153 153
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      */
249 249
     public function getFirstOfItsTypeInArray($type, $array)
250 250
     {
251
-        return array_first($array, function ($item) use ($type) {
251
+        return array_first($array, function($item) use ($type) {
252 252
             return $item['type'] == $type;
253 253
         });
254 254
     }
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 
266 266
     public function sync($type, $fields, $attributes)
267 267
     {
268
-        if (! empty($this->{$type})) {
269
-            $this->{$type} = array_map(function ($field) use ($fields, $attributes) {
268
+        if (!empty($this->{$type})) {
269
+            $this->{$type} = array_map(function($field) use ($fields, $attributes) {
270 270
                 if (in_array($field['name'], (array) $fields)) {
271 271
                     $field = array_merge($field, $attributes);
272 272
                 }
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
                 }
299 299
             }
300 300
 
301
-            return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function ($item) use ($items) {
302
-                return ! in_array($item['name'], $this->sort[$items]);
301
+            return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use ($items) {
302
+                return !in_array($item['name'], $this->sort[$items]);
303 303
             }));
304 304
         }
305 305
 
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
     {
329 329
         $relationArray = explode('.', $relationString);
330 330
 
331
-        if (! isset($length)) {
331
+        if (!isset($length)) {
332 332
             $length = count($relationArray);
333 333
         }
334 334
 
335
-        if (! isset($model)) {
335
+        if (!isset($model)) {
336 336
             $model = $this->model;
337 337
         }
338 338
 
339
-        $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) {
339
+        $result = array_reduce(array_splice($relationArray, 0, $length), function($obj, $method) {
340 340
             return $obj->$method()->getRelated();
341 341
         }, $model);
342 342
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
         $relation = $model->{$firstRelationName};
387 387
 
388 388
         $results = [];
389
-        if (! empty($relation)) {
389
+        if (!empty($relation)) {
390 390
             if ($relation instanceof Collection) {
391 391
                 $currentResults = $relation->toArray();
392 392
             } else {
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
             array_shift($relationArray);
397 397
 
398
-            if (! empty($relationArray)) {
398
+            if (!empty($relationArray)) {
399 399
                 foreach ($currentResults as $currentResult) {
400 400
                     $results = array_merge($results, $this->getRelationModelInstances($currentResult, implode('.', $relationArray)));
401 401
                 }
Please login to merge, or discard this patch.
src/resources/views/fields/select2_nested.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 <div @include('crud::inc.field_wrapper_attributes') >
3 3
     <label>{!! $field['label'] !!}</label>
4 4
     @include('crud::inc.field_translatable_icon')
5
-    <?php $entity_model = $crud->getRelationModel($field['entity'],  - 1); ?>
5
+    <?php $entity_model = $crud->getRelationModel($field['entity'], - 1); ?>
6 6
     <select
7 7
         name="{{ $field['name'] }}"
8 8
         style="width: 100%"
Please login to merge, or discard this patch.
src/resources/views/fields/video.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
 
6 6
 // if attribute casting is used, convert to JSON
7 7
 if (is_array($value)) {
8
-    $value = json_encode((object)$value);
8
+    $value = json_encode((object) $value);
9 9
 } elseif (is_object($value)) {
10 10
     $value = json_encode($value);
11 11
 } else {
Please login to merge, or discard this patch.
src/resources/views/reorder.blade.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,10 +71,10 @@
 block discarded – undo
71 71
                         <ol class="sortable">
72 72
                         <?php
73 73
                             $all_entries = collect($entries->all())->sortBy('lft')->keyBy($crud->getModel()->getKeyName());
74
-                            $root_entries = $all_entries->filter(function ($item) {
74
+                            $root_entries = $all_entries->filter(function($item) {
75 75
                                 return $item->parent_id == 0;
76 76
                             });
77
-                            foreach ($root_entries as $key => $entry){
77
+                            foreach ($root_entries as $key => $entry) {
78 78
                                 $root_entries[$key] = tree_element($entry, $key, $all_entries, $crud);
79 79
                             }
80 80
                         ?>
Please login to merge, or discard this patch.
src/PanelTraits/Columns.php 1 patch
Spacing   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function addColumn($column)
69 69
     {
70 70
         // if a string was passed, not an array, change it to an array
71
-        if (! is_array($column)) {
71
+        if (!is_array($column)) {
72 72
             $column = ['name' => $column];
73 73
         }
74 74
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $column_with_details = $this->addDefaultLabel($column);
77 77
 
78 78
         // make sure the column has a name
79
-        if (! array_key_exists('name', $column_with_details)) {
79
+        if (!array_key_exists('name', $column_with_details)) {
80 80
             $column_with_details['name'] = 'anonymous_column_'.str_random(5);
81 81
         }
82 82
 
@@ -84,27 +84,27 @@  discard block
 block discarded – undo
84 84
         $columnExistsInDb = $this->hasColumn($this->model->getTable(), $column_with_details['name']);
85 85
 
86 86
         // make sure the column has a type
87
-        if (! array_key_exists('type', $column_with_details)) {
87
+        if (!array_key_exists('type', $column_with_details)) {
88 88
             $column_with_details['type'] = 'text';
89 89
         }
90 90
 
91 91
         // make sure the column has a key
92
-        if (! array_key_exists('key', $column_with_details)) {
92
+        if (!array_key_exists('key', $column_with_details)) {
93 93
             $column_with_details['key'] = $column_with_details['name'];
94 94
         }
95 95
 
96 96
         // make sure the column has a tableColumn boolean
97
-        if (! array_key_exists('tableColumn', $column_with_details)) {
97
+        if (!array_key_exists('tableColumn', $column_with_details)) {
98 98
             $column_with_details['tableColumn'] = $columnExistsInDb ? true : false;
99 99
         }
100 100
 
101 101
         // make sure the column has a orderable boolean
102
-        if (! array_key_exists('orderable', $column_with_details)) {
102
+        if (!array_key_exists('orderable', $column_with_details)) {
103 103
             $column_with_details['orderable'] = $columnExistsInDb ? true : false;
104 104
         }
105 105
 
106 106
         // make sure the column has a searchLogic
107
-        if (! array_key_exists('searchLogic', $column_with_details)) {
107
+        if (!array_key_exists('searchLogic', $column_with_details)) {
108 108
             $column_with_details['searchLogic'] = $columnExistsInDb ? true : false;
109 109
         }
110 110
 
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 
113 113
         // make sure the column has a priority in terms of visibility
114 114
         // if no priority has been defined, use the order in the array plus one
115
-        if (! array_key_exists('priority', $column_with_details)) {
115
+        if (!array_key_exists('priority', $column_with_details)) {
116 116
             $position_in_columns_array = (int) array_search($column_with_details['key'], array_keys($this->columns));
117 117
             $this->columns[$column_with_details['key']]['priority'] = $position_in_columns_array + 1;
118 118
         }
119 119
 
120 120
         // if this is a relation type field and no corresponding model was specified, get it from the relation method
121 121
         // defined in the main model
122
-        if (isset($column_with_details['entity']) && ! isset($column_with_details['model'])) {
122
+        if (isset($column_with_details['entity']) && !isset($column_with_details['model'])) {
123 123
             $column_with_details['model'] = $this->getRelationModel($column_with_details['entity']);
124 124
         }
125 125
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function makeFirstColumn()
168 168
     {
169
-        if (! $this->columns) {
169
+        if (!$this->columns) {
170 170
             return false;
171 171
         }
172 172
 
@@ -187,8 +187,7 @@  discard block
 block discarded – undo
187 187
         $targetColumnName = is_array($targetColumn) ? $targetColumn['name'] : $targetColumn;
188 188
 
189 189
         if (array_key_exists($targetColumnName, $this->columns)) {
190
-            $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) :
191
-                array_search($targetColumnName, array_keys($this->columns)) + 1;
190
+            $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : array_search($targetColumnName, array_keys($this->columns)) + 1;
192 191
 
193 192
             $element = array_pop($this->columns);
194 193
             $beginningPart = array_slice($this->columns, 0, $targetColumnPosition, true);
@@ -225,7 +224,7 @@  discard block
 block discarded – undo
225 224
      */
226 225
     public function addDefaultLabel($array)
227 226
     {
228
-        if (! array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) {
227
+        if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) {
229 228
             $array = array_merge(['label' => mb_ucfirst($this->makeLabel($array['name']))], $array);
230 229
 
231 230
             return $array;
@@ -251,7 +250,7 @@  discard block
 block discarded – undo
251 250
      */
252 251
     public function removeColumns($columns)
253 252
     {
254
-        if (! empty($columns)) {
253
+        if (!empty($columns)) {
255 254
             foreach ($columns as $columnName) {
256 255
                 $this->removeColumn($columnName);
257 256
             }
@@ -273,8 +272,8 @@  discard block
 block discarded – undo
273 272
      */
274 273
     public function remove($entity, $fields)
275 274
     {
276
-        return array_values(array_filter($this->{$entity}, function ($field) use ($fields) {
277
-            return ! in_array($field['name'], (array) $fields);
275
+        return array_values(array_filter($this->{$entity}, function($field) use ($fields) {
276
+            return !in_array($field['name'], (array) $fields);
278 277
         }));
279 278
     }
280 279
 
@@ -331,7 +330,7 @@  discard block
 block discarded – undo
331 330
     {
332 331
         $columns = $this->getColumns();
333 332
 
334
-        return collect($columns)->pluck('entity')->reject(function ($value, $key) {
333
+        return collect($columns)->pluck('entity')->reject(function($value, $key) {
335 334
             return $value == null;
336 335
         })->toArray();
337 336
     }
Please login to merge, or discard this patch.
src/PanelTraits/Fields.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,28 +28,28 @@  discard block
 block discarded – undo
28 28
 
29 29
         // if this is a relation type field and no corresponding model was specified, get it from the relation method
30 30
         // defined in the main model
31
-        if (isset($completeFieldsArray['entity']) && ! isset($completeFieldsArray['model'])) {
31
+        if (isset($completeFieldsArray['entity']) && !isset($completeFieldsArray['model'])) {
32 32
             $completeFieldsArray['model'] = $this->getRelationModel($completeFieldsArray['entity']);
33 33
         }
34 34
 
35 35
         // if the label is missing, we should set it
36
-        if (! isset($completeFieldsArray['label'])) {
36
+        if (!isset($completeFieldsArray['label'])) {
37 37
             $completeFieldsArray['label'] = mb_ucfirst(str_replace('_', ' ', $completeFieldsArray['name']));
38 38
         }
39 39
 
40 40
         // if the field type is missing, we should set it
41
-        if (! isset($completeFieldsArray['type'])) {
41
+        if (!isset($completeFieldsArray['type'])) {
42 42
             $completeFieldsArray['type'] = $this->getFieldTypeFromDbColumnType($completeFieldsArray['name']);
43 43
         }
44 44
 
45 45
         // if a tab was mentioned, we should enable it
46 46
         if (isset($completeFieldsArray['tab'])) {
47
-            if (! $this->tabsEnabled()) {
47
+            if (!$this->tabsEnabled()) {
48 48
                 $this->enableTabs();
49 49
             }
50 50
         }
51 51
 
52
-        $this->transformFields($form, function ($fields) use ($completeFieldsArray) {
52
+        $this->transformFields($form, function($fields) use ($completeFieldsArray) {
53 53
             $fields[$completeFieldsArray['name']] = $completeFieldsArray;
54 54
 
55 55
             return $fields;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function afterField($targetFieldName, $form = 'both')
83 83
     {
84
-        $this->transformFields($form, function ($fields) use ($targetFieldName) {
84
+        $this->transformFields($form, function($fields) use ($targetFieldName) {
85 85
             return $this->moveField($fields, $targetFieldName, false);
86 86
         });
87 87
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function beforeField($targetFieldName, $form = 'both')
96 96
     {
97
-        $this->transformFields($form, function ($fields) use ($targetFieldName) {
97
+        $this->transformFields($form, function($fields) use ($targetFieldName) {
98 98
             return $this->moveField($fields, $targetFieldName, true);
99 99
         });
100 100
     }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function removeField($name, $form = 'both')
139 139
     {
140
-        $this->transformFields($form, function ($fields) use ($name) {
140
+        $this->transformFields($form, function($fields) use ($name) {
141 141
             array_forget($fields, $name);
142 142
 
143 143
             return $fields;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function removeFields($array_of_names, $form = 'both')
154 154
     {
155
-        if (! empty($array_of_names)) {
155
+        if (!empty($array_of_names)) {
156 156
             foreach ($array_of_names as $name) {
157 157
                 $this->removeField($name, $form);
158 158
             }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     public function removeAllFields($form = 'both')
168 168
     {
169 169
         $current_fields = $this->getCurrentFields();
170
-        if (! empty($current_fields)) {
170
+        if (!empty($current_fields)) {
171 171
             foreach ($current_fields as $field) {
172 172
                 $this->removeField($field['name'], $form);
173 173
             }
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                 $jsonCastables = ['array', 'object', 'json'];
258 258
                 $fieldCasting = $casted_attributes[$field['name']];
259 259
 
260
-                if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && ! empty($data[$field['name']]) && ! is_array($data[$field['name']])) {
260
+                if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && !empty($data[$field['name']]) && !is_array($data[$field['name']])) {
261 261
                     try {
262 262
                         $data[$field['name']] = json_decode($data[$field['name']]);
263 263
                     } catch (\Exception $e) {
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      */
292 292
     public function orderFields($order, $form = 'both')
293 293
     {
294
-        $this->transformFields($form, function ($fields) use ($order) {
294
+        $this->transformFields($form, function($fields) use ($order) {
295 295
             return $this->applyOrderToFields($fields, $order);
296 296
         });
297 297
     }
Please login to merge, or discard this patch.
src/PanelTraits/Query.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
      */
69 69
     public function customOrderBy($column, $columnDirection = 'asc')
70 70
     {
71
-        if (! isset($column['orderLogic'])) {
71
+        if (!isset($column['orderLogic'])) {
72 72
             return $this->query;
73 73
         }
74 74
 
Please login to merge, or discard this patch.