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 (#1935)
by Cristian
02:10
created
src/PanelTraits/SaveActions.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 
25 25
         $saveOptions = collect($permissions)
26 26
             // Restrict list to allowed actions.
27
-            ->filter(function ($action, $permission) {
27
+            ->filter(function($action, $permission) {
28 28
                 return $this->hasAccess($permission);
29 29
             })
30 30
             // Generate list of possible actions.
31
-            ->mapWithKeys(function ($action, $permission) {
31
+            ->mapWithKeys(function($action, $permission) {
32 32
                 return [$action => $this->getSaveActionButtonName($action)];
33 33
             })
34 34
             ->all();
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function setSaveAction($forceSaveAction = null)
65 65
     {
66
-        $saveAction = $forceSaveAction ?:
67
-            \Request::input('save_action', config('backpack.crud.default_save_action', 'save_and_back'));
66
+        $saveAction = $forceSaveAction ?: \Request::input('save_action', config('backpack.crud.default_save_action', 'save_and_back'));
68 67
 
69 68
         if (config('backpack.crud.show_save_action_change', true) &&
70 69
             session('save_action', 'save_and_back') !== $saveAction) {
Please login to merge, or discard this patch.
src/PanelTraits/Views.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -301,6 +301,9 @@  discard block
 block discarded – undo
301 301
         return $this->getShowView();
302 302
     }
303 303
 
304
+    /**
305
+     * @param string $view
306
+     */
304 307
     public function setPreviewView($view)
305 308
     {
306 309
         return $this->setShowView($view);
@@ -311,6 +314,9 @@  discard block
 block discarded – undo
311 314
         return $this->getEditView();
312 315
     }
313 316
 
317
+    /**
318
+     * @param string $view
319
+     */
314 320
     public function setUpdateView($view)
315 321
     {
316 322
         return $this->setEditView($view);
Please login to merge, or discard this patch.
src/CrudPanel.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function setModel($model_namespace)
78 78
     {
79
-        if (! class_exists($model_namespace)) {
79
+        if (!class_exists($model_namespace)) {
80 80
             throw new \Exception('The model does not exist.', 500);
81 81
         }
82 82
 
83
-        if (! method_exists($model_namespace, 'hasCrudTrait')) {
83
+        if (!method_exists($model_namespace, 'hasCrudTrait')) {
84 84
             throw new \Exception('Please use CrudTrait on the model.', 500);
85 85
         }
86 86
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $complete_route = $route.'.index';
145 145
 
146
-        if (! \Route::has($complete_route)) {
146
+        if (!\Route::has($complete_route)) {
147 147
             throw new \Exception('There are no routes for this route name.', 404);
148 148
         }
149 149
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function getFirstOfItsTypeInArray($type, $array)
246 246
     {
247
-        return array_first($array, function ($item) use ($type) {
247
+        return array_first($array, function($item) use ($type) {
248 248
             return $item['type'] == $type;
249 249
         });
250 250
     }
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 
262 262
     public function sync($type, $fields, $attributes)
263 263
     {
264
-        if (! empty($this->{$type})) {
265
-            $this->{$type} = array_map(function ($field) use ($fields, $attributes) {
264
+        if (!empty($this->{$type})) {
265
+            $this->{$type} = array_map(function($field) use ($fields, $attributes) {
266 266
                 if (in_array($field['name'], (array) $fields)) {
267 267
                     $field = array_merge($field, $attributes);
268 268
                 }
@@ -294,15 +294,15 @@  discard block
 block discarded – undo
294 294
     {
295 295
         $relationArray = explode('.', $relationString);
296 296
 
297
-        if (! isset($length)) {
297
+        if (!isset($length)) {
298 298
             $length = count($relationArray);
299 299
         }
300 300
 
301
-        if (! isset($model)) {
301
+        if (!isset($model)) {
302 302
             $model = $this->model;
303 303
         }
304 304
 
305
-        $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) {
305
+        $result = array_reduce(array_splice($relationArray, 0, $length), function($obj, $method) {
306 306
             return $obj->$method()->getRelated();
307 307
         }, $model);
308 308
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
         $relation = $model->{$firstRelationName};
353 353
 
354 354
         $results = [];
355
-        if (! empty($relation)) {
355
+        if (!empty($relation)) {
356 356
             if ($relation instanceof Collection) {
357 357
                 $currentResults = $relation->toArray();
358 358
             } else {
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
             array_shift($relationArray);
363 363
 
364
-            if (! empty($relationArray)) {
364
+            if (!empty($relationArray)) {
365 365
                 foreach ($currentResults as $currentResult) {
366 366
                     $results = array_merge($results, $this->getRelationModelInstances($currentResult, implode('.', $relationArray)));
367 367
                 }
Please login to merge, or discard this patch.
Unused Use Statements   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,33 +2,33 @@
 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;
20
-use Backpack\CRUD\PanelTraits\Reorder;
21
-use Backpack\CRUD\PanelTraits\Settings;
22
-use Backpack\CRUD\PanelTraits\AutoFocus;
17
+use Backpack\CRUD\PanelTraits\HeadingsAndTitles;
23 18
 use Backpack\CRUD\PanelTraits\Macroable;
24
-use Backpack\CRUD\PanelTraits\FakeFields;
25 19
 use Backpack\CRUD\PanelTraits\Operations;
26
-use Backpack\CRUD\PanelTraits\FakeColumns;
27
-use Backpack\CRUD\PanelTraits\SaveActions;
28
-use Illuminate\Database\Eloquent\Collection;
20
+use Backpack\CRUD\PanelTraits\Query;
21
+use Backpack\CRUD\PanelTraits\Read;
22
+use Backpack\CRUD\PanelTraits\Reorder;
29 23
 use Backpack\CRUD\PanelTraits\RequiredFields;
30
-use Backpack\CRUD\PanelTraits\HeadingsAndTitles;
24
+use Backpack\CRUD\PanelTraits\SaveActions;
25
+use Backpack\CRUD\PanelTraits\Search;
26
+use Backpack\CRUD\PanelTraits\Settings;
27
+use Backpack\CRUD\PanelTraits\Tabs;
28
+use Backpack\CRUD\PanelTraits\Update;
29
+use Backpack\CRUD\PanelTraits\Views;
31 30
 use Backpack\CRUD\PanelTraits\ViewsAndRestoresRevisions;
31
+use Illuminate\Database\Eloquent\Collection;
32 32
 
33 33
 class CrudPanel
34 34
 {
Please login to merge, or discard this patch.
src/PanelTraits/Read.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -175,6 +175,7 @@
 block discarded – undo
175 175
 
176 176
     /**
177 177
      * Set the number of rows that should be show on the list view.
178
+     * @param integer $value
178 179
      */
179 180
     public function setDefaultPageLength($value)
180 181
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $id = $this->getCurrentEntryId();
40 40
 
41
-        if (! $id) {
41
+        if (!$id) {
42 42
             return false;
43 43
         }
44 44
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function getEntry($id)
56 56
     {
57
-        if (! $this->entry) {
57
+        if (!$this->entry) {
58 58
             $this->entry = $this->model->findOrFail($id);
59 59
             $this->entry = $this->entry->withFakes();
60 60
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     {
200 200
         // If the default Page Length isn't in the menu's values, Add it the beginnin and resort all to show a croissant list.
201 201
         // assume both arrays are the same length.
202
-        if (! in_array($this->getDefaultPageLength(), $this->getOperationSetting('pageLengthMenu')[0])) {
202
+        if (!in_array($this->getDefaultPageLength(), $this->getOperationSetting('pageLengthMenu')[0])) {
203 203
             // Loop through 2 arrays of prop. page_length_menu
204 204
             foreach ($this->getOperationSetting('pageLengthMenu') as $key => &$page_length_choices) {
205 205
                 // This is a condition that should be always true.
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     public function getPageLengthMenu()
231 231
     {
232 232
         // if already set, use that
233
-        if (! $this->getOperationSetting('pageLengthMenu')) {
233
+        if (!$this->getOperationSetting('pageLengthMenu')) {
234 234
             // try to get the menu settings from the config file
235 235
             $this->setOperationSetting('pageLengthMenu', config('backpack.crud.page_length_menu') ?? [[10, 25, 50, 100, -1], [10, 25, 50, 100, 'backpack::crud.all']]);
236 236
 
Please login to merge, or discard this patch.
src/PanelTraits/RequiredFields.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
      */
49 49
     public function isRequired($inputName, $operation)
50 50
     {
51
-        if (! $this->has($operation.'.requiredFields')) {
51
+        if (!$this->has($operation.'.requiredFields')) {
52 52
             return false;
53 53
         }
54 54
 
Please login to merge, or discard this patch.
src/PanelTraits/HeadingsAndTitles.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function getTitle($action = false)
23 23
     {
24
-        if (! $action) {
24
+        if (!$action) {
25 25
             $action = $this->getActionMethod();
26 26
         }
27 27
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function setTitle($string, $action = false)
40 40
     {
41
-        if (! $action) {
41
+        if (!$action) {
42 42
             $action = $this->getActionMethod();
43 43
         }
44 44
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function getHeading($action = false)
60 60
     {
61
-        if (! $action) {
61
+        if (!$action) {
62 62
             $action = $this->getActionMethod();
63 63
         }
64 64
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function setHeading($string, $action = false)
77 77
     {
78
-        if (! $action) {
78
+        if (!$action) {
79 79
             $action = $this->getActionMethod();
80 80
         }
81 81
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function getSubheading($action = false)
97 97
     {
98
-        if (! $action) {
98
+        if (!$action) {
99 99
             $action = $this->getActionMethod();
100 100
         }
101 101
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public function setSubheading($string, $action = false)
114 114
     {
115
-        if (! $action) {
115
+        if (!$action) {
116 116
             $action = $this->getActionMethod();
117 117
         }
118 118
 
Please login to merge, or discard this patch.
tests/Unit/CrudPanel/CrudPanelAutoSetTest.php 1 patch
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\Tests\Unit\CrudPanel;
4 4
 
5
-use Doctrine\DBAL\DBALException;
6 5
 use Backpack\CRUD\Tests\Unit\Models\ColumnType;
6
+use Doctrine\DBAL\DBALException;
7 7
 
8 8
 class MyColumnTypeWithOtherConnection extends ColumnType
9 9
 {
Please login to merge, or discard this patch.
src/PanelTraits/AutoFocus.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -12,6 +12,9 @@
 block discarded – undo
12 12
         return $this->getOperationSetting('autoFocusOnFirstField');
13 13
     }
14 14
 
15
+    /**
16
+     * @param boolean $value
17
+     */
15 18
     public function setAutoFocusOnFirstField($value)
16 19
     {
17 20
         return $this->setOperationSetting('autoFocusOnFirstField', (bool) $value);
Please login to merge, or discard this patch.
src/PanelTraits/Buttons.php 2 patches
Doc Comments   +13 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,6 +62,9 @@  discard block
 block discarded – undo
62 62
         $this->addButton($stack, $name, 'model_function', $model_function_name, $position);
63 63
     }
64 64
 
65
+    /**
66
+     * @param string $view
67
+     */
65 68
     public function addButtonFromView($stack, $name, $view, $position = false)
66 69
     {
67 70
         $view = 'crud::buttons.'.$view;
@@ -119,7 +122,7 @@  discard block
 block discarded – undo
119 122
     }
120 123
 
121 124
     /**
122
-     * @param array $names Button names
125
+     * @param string[] $names Button names
123 126
      * @param string|null $stack Optional stack name.
124 127
      */
125 128
     public function removeButtons($names, $stack = null)
@@ -136,6 +139,9 @@  discard block
 block discarded – undo
136 139
         $this->setOperationSetting('buttons', collect());
137 140
     }
138 141
 
142
+    /**
143
+     * @param string $stack
144
+     */
139 145
     public function removeAllButtonsFromStack($stack)
140 146
     {
141 147
         $this->setOperationSetting('buttons', $this->buttons()->reject(function ($button) use ($stack) {
@@ -158,6 +164,12 @@  discard block
 block discarded – undo
158 164
     public $type = 'view';
159 165
     public $content;
160 166
 
167
+    /**
168
+     * @param string $stack
169
+     * @param string $name
170
+     * @param string $type
171
+     * @param string $content
172
+     */
161 173
     public function __construct($stack, $name, $type, $content)
162 174
     {
163 175
         $this->stack = $stack;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
          */
93 93
         $button = $this->buttons()->firstWhere('name', $name);
94 94
 
95
-        if (! $button) {
95
+        if (!$button) {
96 96
             abort(500, 'CRUD Button "'.$name.'" not found. Please check the button exists before you modify it.');
97 97
         }
98 98
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function removeButton($name, $stack = null)
115 115
     {
116
-        $this->setOperationSetting('buttons', $this->buttons()->reject(function ($button) use ($name, $stack) {
116
+        $this->setOperationSetting('buttons', $this->buttons()->reject(function($button) use ($name, $stack) {
117 117
             return $stack == null ? $button->name == $name : ($button->stack == $stack) && ($button->name == $name);
118 118
         }));
119 119
     }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function removeButtons($names, $stack = null)
126 126
     {
127
-        if (! empty($names)) {
127
+        if (!empty($names)) {
128 128
             foreach ($names as $name) {
129 129
                 $this->removeButton($name, $stack);
130 130
             }
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 
139 139
     public function removeAllButtonsFromStack($stack)
140 140
     {
141
-        $this->setOperationSetting('buttons', $this->buttons()->reject(function ($button) use ($stack) {
141
+        $this->setOperationSetting('buttons', $this->buttons()->reject(function($button) use ($stack) {
142 142
             return $button->stack == $stack;
143 143
         }));
144 144
     }
145 145
 
146 146
     public function removeButtonFromStack($name, $stack)
147 147
     {
148
-        $this->setOperationSetting('buttons', $this->buttons()->reject(function ($button) use ($name, $stack) {
148
+        $this->setOperationSetting('buttons', $this->buttons()->reject(function($button) use ($name, $stack) {
149 149
             return $button->name == $name && $button->stack == $stack;
150 150
         }));
151 151
     }
Please login to merge, or discard this patch.