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 (#1026)
by Guilherme
04:42
created
src/app/Http/Controllers/CrudFeatures/AjaxTable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
         // create an array with the names of the searchable columns
16 16
         $columns = collect($this->crud->columns)
17
-                    ->reject(function ($column, $key) {
17
+                    ->reject(function($column, $key) {
18 18
                         // the select_multiple, model_function and model_function_attribute columns are not searchable
19 19
                         return isset($column['type']) && ($column['type'] == 'select_multiple' || $column['type'] == 'model_function' || $column['type'] == 'model_function_attribute');
20 20
                     })
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $dataTable = new \LiveControl\EloquentDataTable\DataTable($this->crud->query, $columns);
30 30
 
31 31
         // make the datatable use the column types instead of just echoing the text
32
-        $dataTable->setFormatRowFunction(function ($entry) {
32
+        $dataTable->setFormatRowFunction(function($entry) {
33 33
             // get the actual HTML for each row's cell
34 34
             $row_items = $this->crud->getRowViews($entry, $this->crud);
35 35
 
Please login to merge, or discard this patch.
src/PanelTraits/FakeColumns.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@
 block discarded – undo
24 24
             if (isset($field['fake']) && $field['fake'] == true) {
25 25
                 // add it to the request in its appropriate variable - the one defined, if defined
26 26
                 if (isset($field['store_in'])) {
27
-                    if (! in_array($field['store_in'], $fakeFieldsColumnsArray, true)) {
27
+                    if (!in_array($field['store_in'], $fakeFieldsColumnsArray, true)) {
28 28
                         array_push($fakeFieldsColumnsArray, $field['store_in']);
29 29
                     }
30 30
                 } else {
31 31
                     //otherwise in the one defined in the $crud variable
32
-                    if (! in_array('extras', $fakeFieldsColumnsArray, true)) {
32
+                    if (!in_array('extras', $fakeFieldsColumnsArray, true)) {
33 33
                         array_push($fakeFieldsColumnsArray, 'extras');
34 34
                     }
35 35
                 }
36 36
             }
37 37
         }
38 38
 
39
-        if (! count($fakeFieldsColumnsArray)) {
39
+        if (!count($fakeFieldsColumnsArray)) {
40 40
             $fakeFieldsColumnsArray = ['extras'];
41 41
         }
42 42
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
      * been found.
10 10
      *
11 11
      * @param string $form The CRUD form. Can be 'create', 'update' or 'both'. Default is 'create'.
12
-     * @param int|bool $id Optional entity ID needed in the case of the update form.
12
+     * @param integer $id Optional entity ID needed in the case of the update form.
13 13
      * @return array The fake columns array.
14 14
      */
15 15
     public function getFakeColumnsAsArray($form = 'create', $id = false)
Please login to merge, or discard this patch.
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 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))) {
40
+            if (!(property_exists($this->model, 'translatable') && in_array($value, $this->model->getTranslatableAttributes(), true))) {
41 41
                 $requestInput[$value] = json_encode($requestInput[$value]);
42 42
             }
43 43
         }
Please login to merge, or discard this patch.
src/PanelTraits/Buttons.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function removeButton($name, $stack = null)
96 96
     {
97
-        $this->buttons = $this->buttons->reject(function ($button) use ($name, $stack) {
97
+        $this->buttons = $this->buttons->reject(function($button) use ($name, $stack) {
98 98
             return $stack == null ? $button->name == $name : ($button->stack == $stack) && ($button->name == $name);
99 99
         });
100 100
     }
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 
107 107
     public function removeAllButtonsFromStack($stack)
108 108
     {
109
-        $this->buttons = $this->buttons->reject(function ($button) use ($stack) {
109
+        $this->buttons = $this->buttons->reject(function($button) use ($stack) {
110 110
             return $button->stack == $stack;
111 111
         });
112 112
     }
113 113
 
114 114
     public function removeButtonFromStack($name, $stack)
115 115
     {
116
-        $this->buttons = $this->buttons->reject(function ($button) use ($name, $stack) {
116
+        $this->buttons = $this->buttons->reject(function($button) use ($name, $stack) {
117 117
             return $button->name == $name && $button->stack == $stack;
118 118
         });
119 119
     }
Please login to merge, or discard this patch.
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -59,6 +59,9 @@  discard block
 block discarded – undo
59 59
         $this->addButton($stack, $name, 'model_function', $model_function_name, $position);
60 60
     }
61 61
 
62
+    /**
63
+     * @param string $view
64
+     */
62 65
     public function addButtonFromView($stack, $name, $view, $position = false)
63 66
     {
64 67
         $view = 'vendor.backpack.crud.buttons.'.$view;
@@ -104,6 +107,9 @@  discard block
 block discarded – undo
104 107
         $this->buttons = collect([]);
105 108
     }
106 109
 
110
+    /**
111
+     * @param string $stack
112
+     */
107 113
     public function removeAllButtonsFromStack($stack)
108 114
     {
109 115
         $this->buttons = $this->buttons->reject(function ($button) use ($stack) {
@@ -126,6 +132,12 @@  discard block
 block discarded – undo
126 132
     public $type = 'view';
127 133
     public $content;
128 134
 
135
+    /**
136
+     * @param string $stack
137
+     * @param string $name
138
+     * @param string $type
139
+     * @param string $content
140
+     */
129 141
     public function __construct($stack, $name, $type, $content)
130 142
     {
131 143
         $this->stack = $stack;
Please login to merge, or discard this patch.
src/PanelTraits/Access.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function hasAccess($permission)
35 35
     {
36
-        if (! in_array($permission, $this->access)) {
36
+        if (!in_array($permission, $this->access)) {
37 37
             return false;
38 38
         }
39 39
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function hasAccessToAll($permission_array)
69 69
     {
70 70
         foreach ($permission_array as $key => $permission) {
71
-            if (! in_array($permission, $this->access)) {
71
+            if (!in_array($permission, $this->access)) {
72 72
                 return false;
73 73
             }
74 74
         }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function hasAccessOrFail($permission)
88 88
     {
89
-        if (! in_array($permission, $this->access)) {
89
+        if (!in_array($permission, $this->access)) {
90 90
             throw new AccessDeniedException(trans('backpack::crud.unauthorized_access'));
91 91
         }
92 92
 
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -12,12 +12,18 @@
 block discarded – undo
12 12
     |--------------------------------------------------------------------------
13 13
     */
14 14
 
15
+    /**
16
+     * @param string $access
17
+     */
15 18
     public function allowAccess($access)
16 19
     {
17 20
         // $this->addButtons((array)$access);
18 21
         return $this->access = array_merge(array_diff((array) $access, $this->access), $this->access);
19 22
     }
20 23
 
24
+    /**
25
+     * @param string $access
26
+     */
21 27
     public function denyAccess($access)
22 28
     {
23 29
         // $this->removeButtons((array)$access);
Please login to merge, or discard this patch.
src/PanelTraits/Delete.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      *
16 16
      * @param  int $id The id of the item to be deleted.
17 17
      *
18
-     * @return bool True if the item was deleted.
18
+     * @return string True if the item was deleted.
19 19
      *
20 20
      * @throws \Illuminate\Database\Eloquent\ModelNotFoundException if the model was not found.
21 21
      *
Please login to merge, or discard this patch.
src/PanelTraits/Columns.php 2 patches
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function addColumn($column)
55 55
     {
56 56
         // if a string was passed, not an array, change it to an array
57
-        if (! is_array($column)) {
57
+        if (!is_array($column)) {
58 58
             $column = ['name' => $column];
59 59
         }
60 60
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $column_with_details = $this->addDefaultLabel($column);
63 63
 
64 64
         // make sure the column has a name
65
-        if (! array_key_exists('name', $column_with_details)) {
65
+        if (!array_key_exists('name', $column_with_details)) {
66 66
             $column_with_details['name'] = 'anonymous_column_'.str_random(5);
67 67
         }
68 68
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         // if this is a relation type field and no corresponding model was specified, get it from the relation method
72 72
         // defined in the main model
73
-        if (isset($column_with_details['entity']) && ! isset($column_with_details['model'])) {
73
+        if (isset($column_with_details['entity']) && !isset($column_with_details['model'])) {
74 74
             $column_with_details['model'] = $this->getRelationModel($column_with_details['entity']);
75 75
         }
76 76
 
@@ -124,8 +124,7 @@  discard block
 block discarded – undo
124 124
         $targetColumnName = is_array($targetColumn) ? $targetColumn['name'] : $targetColumn;
125 125
 
126 126
         if (array_key_exists($targetColumnName, $this->columns)) {
127
-            $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) :
128
-                array_search($targetColumnName, array_keys($this->columns)) + 1;
127
+            $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : array_search($targetColumnName, array_keys($this->columns)) + 1;
129 128
 
130 129
             $element = array_pop($this->columns);
131 130
             $beginningPart = array_slice($this->columns, 0, $targetColumnPosition, true);
@@ -159,7 +158,7 @@  discard block
 block discarded – undo
159 158
      */
160 159
     public function addDefaultLabel($array)
161 160
     {
162
-        if (! array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) {
161
+        if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) {
163 162
             $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array);
164 163
 
165 164
             return $array;
@@ -185,7 +184,7 @@  discard block
 block discarded – undo
185 184
      */
186 185
     public function removeColumns($columns)
187 186
     {
188
-        if (! empty($columns)) {
187
+        if (!empty($columns)) {
189 188
             foreach ($columns as $columnName) {
190 189
                 $this->removeColumn($columnName);
191 190
             }
@@ -206,8 +205,8 @@  discard block
 block discarded – undo
206 205
      */
207 206
     public function remove($entity, $fields)
208 207
     {
209
-        return array_values(array_filter($this->{$entity}, function ($field) use ($fields) {
210
-            return ! in_array($field['name'], (array) $fields);
208
+        return array_values(array_filter($this->{$entity}, function($field) use ($fields) {
209
+            return !in_array($field['name'], (array) $fields);
211 210
         }));
212 211
     }
213 212
 
@@ -258,7 +257,7 @@  discard block
 block discarded – undo
258 257
     {
259 258
         $columns = $this->getColumns();
260 259
 
261
-        return collect($columns)->pluck('entity')->reject(function ($value, $key) {
260
+        return collect($columns)->pluck('entity')->reject(function($value, $key) {
262 261
             return $value == null;
263 262
         })->toArray();
264 263
     }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     /**
95 95
      * Move the most recently added column after the given target column.
96 96
      *
97
-     * @param string|array $targetColumn The target column name or array.
97
+     * @param string $targetColumn The target column name or array.
98 98
      */
99 99
     public function afterColumn($targetColumn)
100 100
     {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     /**
105 105
      * Move the most recently added column before the given target column.
106 106
      *
107
-     * @param string|array $targetColumn The target column name or array.
107
+     * @param string $targetColumn The target column name or array.
108 108
      */
109 109
     public function beforeColumn($targetColumn)
110 110
     {
@@ -227,6 +227,7 @@  discard block
 block discarded – undo
227 227
      *
228 228
      * @param [string] Column name.
229 229
      * @param [attributes and values array]
230
+     * @param string $column
230 231
      */
231 232
     public function setColumnDetails($column, $attributes)
232 233
     {
Please login to merge, or discard this patch.
src/PanelTraits/AutoSet.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -129,6 +129,7 @@
 block discarded – undo
129 129
      * Turn a database column name or PHP variable into a pretty label to be shown to the user.
130 130
      *
131 131
      * @param  [string]
132
+     * @param string $value
132 133
      *
133 134
      * @return [string]
134 135
      */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         $this->setDoctrineTypesMapping();
18 18
         $this->getDbColumnTypes();
19 19
 
20
-        array_map(function ($field) {
20
+        array_map(function($field) {
21 21
             // $this->labels[$field] = $this->makeLabel($field);
22 22
 
23 23
             $new_field = [
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
                 'attributes' => [],
31 31
                 'autoset'    => true,
32 32
             ];
33
-            if (! isset($this->create_fields[$field])) {
33
+            if (!isset($this->create_fields[$field])) {
34 34
                 $this->create_fields[$field] = $new_field;
35 35
             }
36
-            if (! isset($this->update_fields[$field])) {
36
+            if (!isset($this->update_fields[$field])) {
37 37
                 $this->update_fields[$field] = $new_field;
38 38
             }
39 39
 
40
-            if (! in_array($field, $this->model->getHidden()) && ! isset($this->columns[$field])) {
40
+            if (!in_array($field, $this->model->getHidden()) && !isset($this->columns[$field])) {
41 41
                 $this->columns[$field] = [
42 42
                     'name'  => $field,
43 43
                     'label' => ucfirst($field),
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function getFieldTypeFromDbColumnType($field)
79 79
     {
80
-        if (! array_key_exists($field, $this->db_column_types)) {
80
+        if (!array_key_exists($field, $this->db_column_types)) {
81 81
             return 'text';
82 82
         }
83 83
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         $types = ['enum' => 'string'];
145 145
         $platform = \DB::getDoctrineConnection()->getDatabasePlatform();
146 146
         foreach ($types as $type_key => $type_value) {
147
-            if (! $platform->hasDoctrineTypeMappingFor($type_key)) {
147
+            if (!$platform->hasDoctrineTypeMappingFor($type_key)) {
148 148
                 $platform->registerDoctrineTypeMapping($type_key, $type_value);
149 149
             }
150 150
         }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         $columns = $this->model->getConnection()->getSchemaBuilder()->getColumnListing($this->model->getTable());
174 174
         $fillable = $this->model->getFillable();
175 175
 
176
-        if (! empty($fillable)) {
176
+        if (!empty($fillable)) {
177 177
             $columns = array_intersect($columns, $fillable);
178 178
         }
179 179
 
Please login to merge, or discard this patch.
tests/Unit/CrudPanel/CrudPanelCreateTest.php 1 patch
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4 4
 
5
-use Faker\Factory;
6
-use Backpack\CRUD\Tests\Unit\Models\User;
7 5
 use Backpack\CRUD\Tests\Unit\Models\Article;
6
+use Backpack\CRUD\Tests\Unit\Models\User;
7
+use Faker\Factory;
8 8
 
9 9
 class CrudPanelCreateTest extends BaseDBCrudPanelTest
10 10
 {
Please login to merge, or discard this patch.