Completed
Pull Request — master (#3979)
by
unknown
07:34
created
src/Grid/Exporter.php 1 patch
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Grid;
4 4
 
5
-use Encore\Admin\Grid;
5
+use Encore\Admin\Grid;
6 6
 use Encore\Admin\Grid\Exporters\CsvExporter;
7 7
 
8 8
 class Exporter
Please login to merge, or discard this patch.
src/Grid/Exporters/CsvExporter.php 2 patches
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Grid\Exporters;
4 4
 
5
-use Illuminate\Database\Eloquent\Model;
6
-use Illuminate\Support\Arr;
7
-use Illuminate\Support\Collection;
5
+use Illuminate\Database\Eloquent\Model;
6
+use Illuminate\Support\Arr;
7
+use Illuminate\Support\Collection;
8 8
 use Illuminate\Support\Str;
9 9
 
10 10
 class CsvExporter extends AbstractExporter
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
             'Content-Disposition' => "attachment; filename=\"$filename\"",
23 23
         ];
24 24
 
25
-        response()->stream(function () {
25
+        response()->stream(function() {
26 26
             $handle = fopen('php://output', 'w');
27 27
 
28 28
             $titles = [];
29 29
 
30
-            $this->chunk(function ($records) use ($handle, &$titles) {
30
+            $this->chunk(function($records) use ($handle, &$titles) {
31 31
                 if (empty($titles)) {
32 32
                     $titles = $this->getHeaderRowFromRecords($records);
33 33
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function getHeaderRowFromRecords(Collection $records): array
56 56
     {
57 57
         $titles = collect(Arr::dot($records->first()->toArray()))->keys()->map(
58
-            function ($key) {
58
+            function($key) {
59 59
                 $key = str_replace('.', ' ', $key);
60 60
 
61 61
                 return Str::ucfirst($key);
Please login to merge, or discard this patch.
src/Grid/Exporters/ExcelExporter.php 2 patches
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Grid\Exporters;
4 4
 
5
-use Illuminate\Support\Str;
6
-use Maatwebsite\Excel\Concerns\Exportable;
7
-use Maatwebsite\Excel\Concerns\FromQuery;
5
+use Illuminate\Support\Str;
6
+use Maatwebsite\Excel\Concerns\Exportable;
7
+use Maatwebsite\Excel\Concerns\FromQuery;
8 8
 use Maatwebsite\Excel\Concerns\WithHeadings;
9 9
 
10 10
 abstract class ExcelExporter extends AbstractExporter implements FromQuery, WithHeadings
Please login to merge, or discard this 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
             $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.
src/Grid/Filter.php 2 patches
Unused Use Statements   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Grid;
4 4
 
5
-use Encore\Admin\Grid\Filter\AbstractFilter;
6
-use Encore\Admin\Grid\Filter\Layout\Layout;
7
-use Encore\Admin\Grid\Filter\Scope;
8
-use Illuminate\Contracts\Support\Arrayable;
9
-use Illuminate\Contracts\Support\Renderable;
10
-use Illuminate\Support\Arr;
11
-use Illuminate\Support\Collection;
5
+use Encore\Admin\Grid\Filter\AbstractFilter;
6
+use Encore\Admin\Grid\Filter\Layout\Layout;
7
+use Encore\Admin\Grid\Filter\Scope;
8
+use Illuminate\Contracts\Support\Arrayable;
9
+use Illuminate\Contracts\Support\Renderable;
10
+use Illuminate\Support\Arr;
11
+use Illuminate\Support\Collection;
12 12
 use Illuminate\Support\Str;
13 13
 
14 14
 /**
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -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,7 +299,7 @@  discard block
 block discarded – undo
299 299
     {
300 300
         $inputs = Arr::dot(request()->all());
301 301
 
302
-        $inputs = array_filter($inputs, function ($input) {
302
+        $inputs = array_filter($inputs, function($input) {
303 303
             return $input !== '' && !is_null($input);
304 304
         });
305 305
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             }
328 328
         }
329 329
 
330
-        return tap(array_filter($conditions), function ($conditions) {
330
+        return tap(array_filter($conditions), function($conditions) {
331 331
             if (!empty($conditions)) {
332 332
                 $this->expand();
333 333
             }
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Grid/Filter/AbstractFilter.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -345,7 +345,7 @@
 block discarded – undo
345 345
      *
346 346
      * @param Presenter $presenter
347 347
      *
348
-     * @return mixed
348
+     * @return Presenter
349 349
      */
350 350
     protected function setPresenter(Presenter $presenter)
351 351
     {
Please login to merge, or discard this patch.
Unused Use Statements   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Grid\Filter;
4 4
 
5
-use Encore\Admin\Grid\Filter;
6
-use Encore\Admin\Grid\Filter\Presenter\Checkbox;
7
-use Encore\Admin\Grid\Filter\Presenter\DateTime;
8
-use Encore\Admin\Grid\Filter\Presenter\MultipleSelect;
9
-use Encore\Admin\Grid\Filter\Presenter\Presenter;
10
-use Encore\Admin\Grid\Filter\Presenter\Radio;
11
-use Encore\Admin\Grid\Filter\Presenter\Select;
12
-use Encore\Admin\Grid\Filter\Presenter\Text;
13
-use Illuminate\Support\Arr;
5
+use Encore\Admin\Grid\Filter;
6
+use Encore\Admin\Grid\Filter\Presenter\Checkbox;
7
+use Encore\Admin\Grid\Filter\Presenter\DateTime;
8
+use Encore\Admin\Grid\Filter\Presenter\MultipleSelect;
9
+use Encore\Admin\Grid\Filter\Presenter\Presenter;
10
+use Encore\Admin\Grid\Filter\Presenter\Radio;
11
+use Encore\Admin\Grid\Filter\Presenter\Select;
12
+use Encore\Admin\Grid\Filter\Presenter\Text;
13
+use Illuminate\Support\Arr;
14 14
 use Illuminate\Support\Collection;
15 15
 
16 16
 /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -453,7 +453,7 @@
 block discarded – undo
453 453
 
454 454
         list($relation, $args[0]) = explode('.', $this->column);
455 455
 
456
-        return ['whereHas' => [$relation, function ($relation) use ($args) {
456
+        return ['whereHas' => [$relation, function($relation) use ($args) {
457 457
             call_user_func_array([$relation, $this->query], $args);
458 458
         }]];
459 459
     }
Please login to merge, or discard this patch.
src/Grid/Filter/Between.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Grid\Filter;
4 4
 
5
-use Encore\Admin\Admin;
5
+use Encore\Admin\Admin;
6 6
 use Illuminate\Support\Arr;
7 7
 
8 8
 class Between extends AbstractFilter
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 
66 66
         $this->value = Arr::get($inputs, $this->column);
67 67
 
68
-        $value = array_filter($this->value, function ($val) {
68
+        $value = array_filter($this->value, function($val) {
69 69
             return $val !== '';
70 70
         });
71 71
 
Please login to merge, or discard this patch.
src/Grid/Filter/Group.php 1 patch
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Grid\Filter;
4 4
 
5
-use Encore\Admin\Admin;
6
-use Illuminate\Support\Arr;
5
+use Encore\Admin\Admin;
6
+use Illuminate\Support\Arr;
7 7
 use Illuminate\Support\Collection;
8 8
 
9 9
 class Group extends AbstractFilter
Please login to merge, or discard this patch.
src/Grid/Filter/Presenter/Radio.php 1 patch
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Grid\Filter\Presenter;
4 4
 
5
-use Encore\Admin\Facades\Admin;
5
+use Encore\Admin\Facades\Admin;
6 6
 use Illuminate\Contracts\Support\Arrayable;
7 7
 
8 8
 class Radio extends Presenter
Please login to merge, or discard this patch.
src/Grid/Filter/Presenter/Select.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -303,7 +303,7 @@
 block discarded – undo
303 303
      *
304 304
      * @param string $target
305 305
      *
306
-     * @return mixed
306
+     * @return string
307 307
      */
308 308
     protected function getClass($target) : string
309 309
     {
Please login to merge, or discard this patch.
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Grid\Filter\Presenter;
4 4
 
5
-use Encore\Admin\Facades\Admin;
6
-use Illuminate\Contracts\Support\Arrayable;
7
-use Illuminate\Database\Eloquent\Model;
5
+use Encore\Admin\Facades\Admin;
6
+use Illuminate\Contracts\Support\Arrayable;
7
+use Illuminate\Database\Eloquent\Model;
8 8
 use Illuminate\Support\Arr;
9 9
 
10 10
 class Select extends Presenter
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
             throw new \InvalidArgumentException("[$model] must be a valid model class");
119 119
         }
120 120
 
121
-        $this->options = function ($value) use ($model, $idField, $textField) {
121
+        $this->options = function($value) use ($model, $idField, $textField) {
122 122
             if (empty($value)) {
123 123
                 return [];
124 124
             }
Please login to merge, or discard this patch.