Completed
Pull Request — master (#4435)
by Muhlis
07:58
created
src/Grid/Concerns/HasSelector.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
         call_user_func($closure, $this->selector);
28 28
 
29
-        $this->header(function () {
29
+        $this->header(function() {
30 30
             return $this->renderSelector();
31 31
         });
32 32
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
         $active = Selector::parseSelected();
48 48
 
49
-        $this->selector->getSelectors()->each(function ($selector, $column) use ($active) {
50
-            if (! array_key_exists($column, $active)) {
49
+        $this->selector->getSelectors()->each(function($selector, $column) use ($active) {
50
+            if (!array_key_exists($column, $active)) {
51 51
                 return;
52 52
             }
53 53
 
Please login to merge, or discard this patch.
src/Grid/Concerns/CanHidesColumns.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function disableColumnSelector(bool $disable = true)
26 26
     {
27
-        return $this->option('show_column_selector', ! $disable);
27
+        return $this->option('show_column_selector', !$disable);
28 28
     }
29 29
 
30 30
     /**
@@ -72,8 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $columns = explode(',', request(ColumnSelector::SELECT_COLUMN_NAME));
74 74
 
75
-        return array_filter($columns) ?:
76
-            array_values(array_diff($this->columnNames, $this->hiddenColumns));
75
+        return array_filter($columns) ?: array_values(array_diff($this->columnNames, $this->hiddenColumns));
77 76
     }
78 77
 
79 78
     /**
@@ -91,7 +90,7 @@  discard block
 block discarded – undo
91 90
 
92 91
         array_push($visible, Grid\Column::SELECT_COLUMN_NAME, Grid\Column::ACTION_COLUMN_NAME);
93 92
 
94
-        return $this->columns->filter(function (Grid\Column $column) use ($visible) {
93
+        return $this->columns->filter(function(Grid\Column $column) use ($visible) {
95 94
             return in_array($column->getName(), $visible);
96 95
         });
97 96
     }
@@ -111,7 +110,7 @@  discard block
 block discarded – undo
111 110
 
112 111
         array_push($visible, Grid\Column::SELECT_COLUMN_NAME, Grid\Column::ACTION_COLUMN_NAME);
113 112
 
114
-        return collect($this->columnNames)->filter(function ($column) use ($visible) {
113
+        return collect($this->columnNames)->filter(function($column) use ($visible) {
115 114
             return in_array($column, $visible);
116 115
         })->toArray();
117 116
     }
Please login to merge, or discard this patch.
src/Grid/Concerns/HasQuickSearch.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             $this->search = $search;
42 42
         }
43 43
 
44
-        return tap(new Tools\QuickSearch(), function ($search) {
44
+        return tap(new Tools\QuickSearch(), function($search) {
45 45
             $this->tools->append($search);
46 46
         });
47 47
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function applyQuickSearch()
55 55
     {
56
-        if (! $query = request()->get(static::$searchKey)) {
56
+        if (!$query = request()->get(static::$searchKey)) {
57 57
             return;
58 58
         }
59 59
 
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
      */
126 126
     protected function parseQueryBindings(array $queries)
127 127
     {
128
-        $columnMap = $this->columns->mapWithKeys(function (Column $column) {
128
+        $columnMap = $this->columns->mapWithKeys(function(Column $column) {
129 129
             $label = $column->getLabel();
130 130
             $name = $column->getName();
131 131
 
132 132
             return [$label => $name, $name => $name];
133 133
         });
134 134
 
135
-        return collect($queries)->map(function ($query) use ($columnMap) {
135
+        return collect($queries)->map(function($query) use ($columnMap) {
136 136
             $segments = explode(':', $query, 2);
137 137
 
138 138
             if (count($segments) != 2) {
Please login to merge, or discard this patch.
src/Grid/Concerns/HasTotalRow.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $this->totalRowColumns[$column] = $callback;
29 29
 
30
-        if (! isset($this->totalRowOperations[$column])) {
30
+        if (!isset($this->totalRowOperations[$column])) {
31 31
             $this->addTotalOperation($column, 'sum');
32 32
         }
33 33
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function addTotalOperation($column, $operation, $callback = null)
44 44
     {
45
-        if (! is_null($callback)) {
45
+        if (!is_null($callback)) {
46 46
             $this->totalRowColumns[$column] = $callback;
47 47
         }
48 48
 
Please login to merge, or discard this patch.
src/Grid/Concerns/HasQuickCreate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     public function hasQuickCreate()
36 36
     {
37
-        return ! is_null($this->quickCreate);
37
+        return !is_null($this->quickCreate);
38 38
     }
39 39
 
40 40
     /**
Please login to merge, or discard this patch.
src/Grid/Concerns/HasActions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function disableActions(bool $disable = true)
78 78
     {
79
-        return $this->option('show_actions', ! $disable);
79
+        return $this->option('show_actions', !$disable);
80 80
     }
81 81
 
82 82
     /**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function batchActions(Closure $closure)
90 90
     {
91
-        $this->tools(function (Grid\Tools $tools) use ($closure) {
91
+        $this->tools(function(Grid\Tools $tools) use ($closure) {
92 92
             $tools->batch($closure);
93 93
         });
94 94
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $this->tools->disableBatchActions($disable);
106 106
 
107
-        return $this->option('show_row_selector', ! $disable);
107
+        return $this->option('show_row_selector', !$disable);
108 108
     }
109 109
 
110 110
     /**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     protected function appendActionsColumn()
116 116
     {
117
-        if (! $this->option('show_actions')) {
117
+        if (!$this->option('show_actions')) {
118 118
             return;
119 119
         }
120 120
 
Please login to merge, or discard this patch.
src/Grid/Filter.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      */
252 252
     public function disableIdFilter(bool $disable = true)
253 253
     {
254
-        $this->useIdFilter = ! $disable;
254
+        $this->useIdFilter = !$disable;
255 255
 
256 256
         return $this;
257 257
     }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
      */
262 262
     public function removeIDFilterIfNeeded()
263 263
     {
264
-        if (! $this->useIdFilter && ! $this->idFilterRemoved) {
264
+        if (!$this->useIdFilter && !$this->idFilterRemoved) {
265 265
             $this->removeDefaultIDFilter();
266 266
 
267 267
             $this->layout->removeDefaultIDFilter();
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function removeFilterByID($id)
287 287
     {
288
-        $this->filters = array_filter($this->filters, function (AbstractFilter $filter) use ($id) {
288
+        $this->filters = array_filter($this->filters, function(AbstractFilter $filter) use ($id) {
289 289
             return $filter->getId() != $id;
290 290
         });
291 291
     }
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
     {
300 300
         $inputs = Arr::dot(request()->all());
301 301
 
302
-        $inputs = array_filter($inputs, function ($input) {
303
-            return $input !== '' && ! is_null($input);
302
+        $inputs = array_filter($inputs, function($input) {
303
+            return $input !== '' && !is_null($input);
304 304
         });
305 305
 
306 306
         $this->sanitizeInputs($inputs);
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
             }
328 328
         }
329 329
 
330
-        return tap(array_filter($conditions), function ($conditions) {
331
-            if (! empty($conditions)) {
330
+        return tap(array_filter($conditions), function($conditions) {
331
+            if (!empty($conditions)) {
332 332
                 $this->expand();
333 333
             }
334 334
         });
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
      */
342 342
     protected function sanitizeInputs(&$inputs)
343 343
     {
344
-        if (! $this->name) {
344
+        if (!$this->name) {
345 345
             return $inputs;
346 346
         }
347 347
 
348
-        $inputs = collect($inputs)->filter(function ($input, $key) {
348
+        $inputs = collect($inputs)->filter(function($input, $key) {
349 349
             return Str::startsWith($key, "{$this->name}_");
350
-        })->mapWithKeys(function ($val, $key) {
350
+        })->mapWithKeys(function($val, $key) {
351 351
             $key = str_replace("{$this->name}_", '', $key);
352 352
 
353 353
             return [$key => $val];
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
      */
418 418
     public function scope($key, $label = '')
419 419
     {
420
-        return tap(new Scope($key, $label), function (Scope $scope) {
420
+        return tap(new Scope($key, $label), function(Scope $scope) {
421 421
             return $this->scopes->push($scope);
422 422
         });
423 423
     }
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
     {
452 452
         $key = request(Scope::QUERY_NAME);
453 453
 
454
-        return $this->scopes->first(function ($scope) use ($key) {
454
+        return $this->scopes->first(function($scope) use ($key) {
455 455
             return $scope->key == $key;
456 456
         });
457 457
     }
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 
577 577
         $columns->push($pageKey);
578 578
 
579
-        $groupNames = collect($this->filters)->filter(function ($filter) {
579
+        $groupNames = collect($this->filters)->filter(function($filter) {
580 580
             return $filter instanceof Filter\Group;
581
-        })->map(function (AbstractFilter $filter) {
581
+        })->map(function(AbstractFilter $filter) {
582 582
             return "{$filter->getId()}_group";
583 583
         });
584 584
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
      */
631 631
     public static function extend($name, $filterClass)
632 632
     {
633
-        if (! is_subclass_of($filterClass, AbstractFilter::class)) {
633
+        if (!is_subclass_of($filterClass, AbstractFilter::class)) {
634 634
             throw new \InvalidArgumentException("The class [$filterClass] must be a type of ".AbstractFilter::class.'.');
635 635
         }
636 636
 
Please login to merge, or discard this patch.
src/Grid/Column/RangeFilter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@
 block discarded – undo
40 40
             return;
41 41
         }
42 42
 
43
-        if (! isset($value['start'])) {
43
+        if (!isset($value['start'])) {
44 44
             return $model->where($this->getColumnName(), '<', $value['end']);
45
-        } elseif (! isset($value['end'])) {
45
+        } elseif (!isset($value['end'])) {
46 46
             return $model->where($this->getColumnName(), '>', $value['start']);
47 47
         } else {
48 48
             return $model->whereBetween($this->getColumnName(), array_values($value));
Please login to merge, or discard this patch.
src/Grid/Exporters/ExcelExporter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function headings(): array
33 33
     {
34
-        if (! empty($this->columns)) {
34
+        if (!empty($this->columns)) {
35 35
             return array_values($this->columns);
36 36
         }
37 37
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function query()
45 45
     {
46
-        if (! empty($this->columns)) {
46
+        if (!empty($this->columns)) {
47 47
             $columns = array_keys($this->columns);
48 48
 
49 49
             $eagerLoads = array_keys($this->getQuery()->getEagerLoads());
50 50
 
51
-            $columns = collect($columns)->reject(function ($column) use ($eagerLoads) {
51
+            $columns = collect($columns)->reject(function($column) use ($eagerLoads) {
52 52
                 return Str::contains($column, '.') || in_array($column, $eagerLoads);
53 53
             });
54 54
 
Please login to merge, or discard this patch.