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 (#1964)
by Cristian
03:09
created
tests/Unit/CrudPanel/CrudPanelTabsTest.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 Illuminate\Support\Facades\DB;
6 5
 use Backpack\CRUD\Tests\Unit\Models\Article;
6
+use Illuminate\Support\Facades\DB;
7 7
 
8 8
 class CrudPanelTabsTest extends BaseDBCrudPanelTest
9 9
 {
Please login to merge, or discard this patch.
src/PanelTraits/Buttons.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
          */
108 108
         $button = $this->buttons()->firstWhere('name', $name);
109 109
 
110
-        if (! $button) {
110
+        if (!$button) {
111 111
             abort(500, 'CRUD Button "'.$name.'" not found. Please check the button exists before you modify it.');
112 112
         }
113 113
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function removeButton($name, $stack = null)
130 130
     {
131
-        $this->buttons = $this->buttons->reject(function ($button) use ($name, $stack) {
131
+        $this->buttons = $this->buttons->reject(function($button) use ($name, $stack) {
132 132
             return $stack == null ? $button->name == $name : ($button->stack == $stack) && ($button->name == $name);
133 133
         });
134 134
     }
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 
141 141
     public function removeAllButtonsFromStack($stack)
142 142
     {
143
-        $this->buttons = $this->buttons->reject(function ($button) use ($stack) {
143
+        $this->buttons = $this->buttons->reject(function($button) use ($stack) {
144 144
             return $button->stack == $stack;
145 145
         });
146 146
     }
147 147
 
148 148
     public function removeButtonFromStack($name, $stack)
149 149
     {
150
-        $this->buttons = $this->buttons->reject(function ($button) use ($name, $stack) {
150
+        $this->buttons = $this->buttons->reject(function($button) use ($name, $stack) {
151 151
             return $button->name == $name && $button->stack == $stack;
152 152
         });
153 153
     }
Please login to merge, or discard this patch.
Doc Comments   +12 added 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;
@@ -139,6 +142,9 @@  discard block
 block discarded – undo
139 142
         $this->buttons = collect([]);
140 143
     }
141 144
 
145
+    /**
146
+     * @param string $stack
147
+     */
142 148
     public function removeAllButtonsFromStack($stack)
143 149
     {
144 150
         $this->buttons = $this->buttons->reject(function ($button) use ($stack) {
@@ -161,6 +167,12 @@  discard block
 block discarded – undo
161 167
     public $type = 'view';
162 168
     public $content;
163 169
 
170
+    /**
171
+     * @param string $stack
172
+     * @param string $name
173
+     * @param string $type
174
+     * @param string $content
175
+     */
164 176
     public function __construct($stack, $name, $type, $content)
165 177
     {
166 178
         $this->stack = $stack;
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 2 patches
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.
Unused Use Statements   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -2,31 +2,31 @@
 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\AutoFocus;
17
+use Backpack\CRUD\PanelTraits\HeadingsAndTitle;
22 18
 use Backpack\CRUD\PanelTraits\Macroable;
23
-use Backpack\CRUD\PanelTraits\FakeFields;
24 19
 use Backpack\CRUD\PanelTraits\Operations;
25
-use Backpack\CRUD\PanelTraits\FakeColumns;
26
-use Illuminate\Database\Eloquent\Collection;
20
+use Backpack\CRUD\PanelTraits\Query;
21
+use Backpack\CRUD\PanelTraits\Read;
22
+use Backpack\CRUD\PanelTraits\Reorder;
27 23
 use Backpack\CRUD\PanelTraits\RequiredFields;
28
-use Backpack\CRUD\PanelTraits\HeadingsAndTitle;
24
+use Backpack\CRUD\PanelTraits\Search;
25
+use Backpack\CRUD\PanelTraits\Tabs;
26
+use Backpack\CRUD\PanelTraits\Update;
27
+use Backpack\CRUD\PanelTraits\Views;
29 28
 use Backpack\CRUD\PanelTraits\ViewsAndRestoresRevisions;
29
+use Illuminate\Database\Eloquent\Collection;
30 30
 
31 31
 class CrudPanel
32 32
 {
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/Views.php 1 patch
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
     /**
159 159
      * Sets the edit content class.
160
-     * @param string $editContentClass content class
160
+     * @param string $showContentClass content class
161 161
      */
162 162
     public function setShowContentClass(string $showContentClass)
163 163
     {
@@ -332,6 +332,9 @@  discard block
 block discarded – undo
332 332
         return $this->getShowView();
333 333
     }
334 334
 
335
+    /**
336
+     * @param string $view
337
+     */
335 338
     public function setPreviewView($view)
336 339
     {
337 340
         return $this->setShowView($view);
@@ -342,6 +345,9 @@  discard block
 block discarded – undo
342 345
         return $this->getEditView();
343 346
     }
344 347
 
348
+    /**
349
+     * @param string $view
350
+     */
345 351
     public function setUpdateView($view)
346 352
     {
347 353
         return $this->setEditView($view);
Please login to merge, or discard this patch.
src/PanelTraits/Query.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
      * Order results of the query in a custom way.
63 63
      *
64 64
      * @param  array $column           Column array with all attributes
65
-     * @param  string $column_direction ASC or DESC
65
+     * @param  string $columnDirection ASC or DESC
66 66
      *
67 67
      * @return \Illuminate\Database\Eloquent\Builder
68 68
      */
Please login to merge, or discard this 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.