Completed
Pull Request — master (#1350)
by
unknown
03:06
created
src/Grid/Filter/Between.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 
55 55
         $this->value = array_get($inputs, $this->column);
56 56
 
57
-        $value = array_filter($this->value, function ($val) {
57
+        $value = array_filter($this->value, function($val) {
58 58
             return $val !== '';
59 59
         });
60 60
 
Please login to merge, or discard this patch.
src/Grid/Row.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
     public function style($style)
135 135
     {
136 136
         if (is_array($style)) {
137
-            $style = implode('', array_map(function ($key, $val) {
137
+            $style = implode('', array_map(function($key, $val) {
138 138
                 return "$key:$val";
139 139
             }, array_keys($style), array_values($style)));
140 140
         }
Please login to merge, or discard this patch.
src/Widgets/Box.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
             return $this->style([$styles]);
65 65
         }
66 66
 
67
-        $styles = array_map(function ($style) {
67
+        $styles = array_map(function($style) {
68 68
             return 'box-'.$style;
69 69
         }, $styles);
70 70
 
Please login to merge, or discard this patch.
src/Widgets/Form.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
     /**
118 118
      * Add form attributes.
119 119
      *
120
-     * @param string|array $attr
120
+     * @param string $attr
121 121
      * @param string       $value
122 122
      *
123 123
      * @return $this
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 use Illuminate\Contracts\Validation\Validator;
9 9
 use Illuminate\Support\Facades\Input;
10 10
 use Illuminate\Support\MessageBag;
11
-use phpDocumentor\Reflection\Types\This;
12 11
 
13 12
 /**
14 13
  * Class Form.
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function setWidth($fieldWidth = 8, $labelWidth = 2)
174 174
     {
175
-        collect($this->fields)->each(function ($field) use ($fieldWidth, $labelWidth) {
175
+        collect($this->fields)->each(function($field) use ($fieldWidth, $labelWidth) {
176 176
             /* @var Field $field */
177 177
             $field->setWidth($fieldWidth, $labelWidth);
178 178
         });
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     {
342 342
         $rules = [];
343 343
         foreach ($this->fields as $item) {
344
-            if(!empty($item->getRules())){
344
+            if (!empty($item->getRules())) {
345 345
                 $rules[$item->id] = $item->getRules();
346 346
             }
347 347
         }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     public function getRuleMessages()
358 358
     {
359 359
         $rules = [];
360
-        foreach ($this->fields as $item ) {
360
+        foreach ($this->fields as $item) {
361 361
             foreach ($item->validationMessages as $key => $value) {
362 362
                 $rules[$key] = $value;
363 363
             }
Please login to merge, or discard this patch.
src/Grid/Model.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     /**
241 241
      * Resolve perPage for pagination.
242 242
      *
243
-     * @param array|null $paginate
243
+     * @param Model $paginate
244 244
      *
245 245
      * @return array
246 246
      */
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     /**
263 263
      * Find query by method name.
264 264
      *
265
-     * @param $method
265
+     * @param string $method
266 266
      *
267 267
      * @return static
268 268
      */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 
226 226
         $this->setSort();
227 227
 
228
-        $this->queries->reject(function ($query) {
228
+        $this->queries->reject(function($query) {
229 229
             return $query['method'] == 'paginate';
230
-        })->each(function ($query) {
230
+        })->each(function($query) {
231 231
             $this->model = $this->model->{$query['method']}(...$query['arguments']);
232 232
         });
233 233
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         $this->setSort();
275 275
         $this->setPaginate();
276 276
 
277
-        $this->queries->unique()->each(function ($query) {
277
+        $this->queries->unique()->each(function($query) {
278 278
             $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']);
279 279
         });
280 280
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     {
319 319
         $paginate = $this->findQueryByMethod('paginate');
320 320
 
321
-        $this->queries = $this->queries->reject(function ($query) {
321
+        $this->queries = $this->queries->reject(function($query) {
322 322
             return $query['method'] == 'paginate';
323 323
         });
324 324
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
      */
373 373
     protected function findQueryByMethod($method)
374 374
     {
375
-        return $this->queries->first(function ($query) use ($method) {
375
+        return $this->queries->first(function($query) use ($method) {
376 376
             return $query['method'] == $method;
377 377
         });
378 378
     }
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
     {
417 417
         list($relationName, $relationColumn) = explode('.', $column);
418 418
 
419
-        if ($this->queries->contains(function ($query) use ($relationName) {
419
+        if ($this->queries->contains(function($query) use ($relationName) {
420 420
             return $query['method'] == 'with' && in_array($relationName, $query['arguments']);
421 421
         })) {
422 422
             $relation = $this->model->$relationName();
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      */
446 446
     public function resetOrderBy()
447 447
     {
448
-        $this->queries = $this->queries->reject(function ($query) {
448
+        $this->queries = $this->queries->reject(function($query) {
449 449
             return $query['method'] == 'orderBy';
450 450
         });
451 451
     }
Please login to merge, or discard this patch.
src/Console/MakeCommand.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     /**
26 26
      * Execute the console command.
27 27
      *
28
-     * @return void
28
+     * @return false|null
29 29
      */
30 30
     public function handle()
31 31
     {
Please login to merge, or discard this patch.
src/Controllers/PermissionController.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@
 block discarded – undo
131 131
     /**
132 132
      * Get options of HTTP methods select field.
133 133
      *
134
-     * @return array
134
+     * @return callable
135 135
      */
136 136
     protected function getHttpMethodsOptions()
137 137
     {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function index()
23 23
     {
24
-        return Admin::content(function (Content $content) {
24
+        return Admin::content(function(Content $content) {
25 25
             $content->header(trans('admin.permissions'));
26 26
             $content->description(trans('admin.list'));
27 27
             $content->body($this->grid()->render());
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function edit($id)
39 39
     {
40
-        return Admin::content(function (Content $content) use ($id) {
40
+        return Admin::content(function(Content $content) use ($id) {
41 41
             $content->header(trans('admin.permissions'));
42 42
             $content->description(trans('admin.edit'));
43 43
             $content->body($this->form()->edit($id));
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function create()
53 53
     {
54
-        return Admin::content(function (Content $content) {
54
+        return Admin::content(function(Content $content) {
55 55
             $content->header(trans('admin.permissions'));
56 56
             $content->description(trans('admin.create'));
57 57
             $content->body($this->form());
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function grid()
67 67
     {
68
-        return Admin::grid(Permission::class, function (Grid $grid) {
68
+        return Admin::grid(Permission::class, function(Grid $grid) {
69 69
             $grid->id('ID')->sortable();
70 70
             $grid->slug(trans('admin.slug'));
71 71
             $grid->name(trans('admin.name'));
72 72
 
73
-            $grid->http_path(trans('admin.route'))->display(function ($path) {
74
-                return collect(explode("\r\n", $path))->map(function ($path) {
73
+            $grid->http_path(trans('admin.route'))->display(function($path) {
74
+                return collect(explode("\r\n", $path))->map(function($path) {
75 75
                     $method = $this->http_method ?: ['ANY'];
76 76
 
77 77
                     if (Str::contains($path, ':')) {
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
                         $method = explode(',', $method);
80 80
                     }
81 81
 
82
-                    $method = collect($method)->map(function ($name) {
82
+                    $method = collect($method)->map(function($name) {
83 83
                         return strtoupper($name);
84
-                    })->map(function ($name) {
84
+                    })->map(function($name) {
85 85
                         return "<span class='label label-primary'>{$name}</span>";
86 86
                     })->implode('&nbsp;');
87 87
 
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
             $grid->created_at(trans('admin.created_at'));
95 95
             $grid->updated_at(trans('admin.updated_at'));
96 96
 
97
-            $grid->tools(function (Grid\Tools $tools) {
98
-                $tools->batch(function (Grid\Tools\BatchActions $actions) {
97
+            $grid->tools(function(Grid\Tools $tools) {
98
+                $tools->batch(function(Grid\Tools\BatchActions $actions) {
99 99
                     $actions->disableDelete();
100 100
                 });
101 101
             });
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function form()
111 111
     {
112
-        return Admin::form(Permission::class, function (Form $form) {
112
+        return Admin::form(Permission::class, function(Form $form) {
113 113
             $form->display('id', 'ID');
114 114
 
115 115
             $form->text('slug', trans('admin.slug'))->rules('required');
Please login to merge, or discard this patch.
src/Form.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      *
279 279
      * @param $id
280 280
      *
281
-     * @return mixed
281
+     * @return boolean
282 282
      */
283 283
     public function destroy($id)
284 284
     {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     /**
318 318
      * Store a new record.
319 319
      *
320
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\Http\JsonResponse
320
+     * @return Response
321 321
      */
322 322
     public function store()
323 323
     {
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
      *
397 397
      * @param array $data
398 398
      *
399
-     * @return mixed
399
+     * @return Response|null
400 400
      */
401 401
     protected function prepare($data = [])
402 402
     {
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
     /**
855 855
      * Set saved callback.
856 856
      *
857
-     * @param callable $callback
857
+     * @param Closure $callback
858 858
      *
859 859
      * @return void
860 860
      */
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
         $data = $this->model->with($this->getRelations())
329 329
             ->findOrFail($id)->toArray();
330 330
 
331
-        $this->builder->fields()->filter(function ($field) {
331
+        $this->builder->fields()->filter(function($field) {
332 332
             return $field instanceof Field\File;
333
-        })->each(function (File $file) use ($data) {
333
+        })->each(function(File $file) use ($data) {
334 334
             $file->setOriginal($data);
335 335
 
336 336
             $file->destroy();
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             return $response;
356 356
         }
357 357
 
358
-        DB::transaction(function () {
358
+        DB::transaction(function() {
359 359
             $inserts = $this->prepareInsert($this->updates);
360 360
 
361 361
             foreach ($inserts as $column => $value) {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
             return $response;
560 560
         }
561 561
 
562
-        DB::transaction(function () {
562
+        DB::transaction(function() {
563 563
             $updates = $this->prepareUpdate($this->updates);
564 564
 
565 565
             foreach ($updates as $column => $value) {
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
      */
808 808
     protected function invalidColumn($columns, $oneToOneRelation = false)
809 809
     {
810
-        foreach ((array)$columns as $column) {
810
+        foreach ((array) $columns as $column) {
811 811
             if ((!$oneToOneRelation && Str::contains($column, '.')) ||
812 812
                 ($oneToOneRelation && !Str::contains($column, '.'))
813 813
             ) {
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
      */
917 917
     public function ignore($fields)
918 918
     {
919
-        $this->ignored = array_merge($this->ignored, (array)$fields);
919
+        $this->ignored = array_merge($this->ignored, (array) $fields);
920 920
 
921 921
         return $this;
922 922
     }
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
     protected function getFieldByColumn($column)
957 957
     {
958 958
         return $this->builder->fields()->first(
959
-            function (Field $field) use ($column) {
959
+            function(Field $field) use ($column) {
960 960
                 if (is_array($field->column())) {
961 961
                     return in_array($column, $field->column());
962 962
                 }
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 
978 978
         $values = $this->model->toArray();
979 979
 
980
-        $this->builder->fields()->each(function (Field $field) use ($values) {
980
+        $this->builder->fields()->each(function(Field $field) use ($values) {
981 981
             $field->setOriginal($values);
982 982
         });
983 983
     }
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
 
1000 1000
         $data = $this->model->toArray();
1001 1001
 
1002
-        $this->builder->fields()->each(function (Field $field) use ($data) {
1002
+        $this->builder->fields()->each(function(Field $field) use ($data) {
1003 1003
             $field->fill($data);
1004 1004
         });
1005 1005
     }
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
      */
1119 1119
     public function setWidth($fieldWidth = 8, $labelWidth = 2)
1120 1120
     {
1121
-        $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) {
1121
+        $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) {
1122 1122
             /* @var Field $field */
1123 1123
             $field->setWidth($fieldWidth, $labelWidth);
1124 1124
         });
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -228,7 +228,9 @@
 block discarded – undo
228 228
     public function edit($id, $show_mode = false)
229 229
     {
230 230
         $mode = Builder::MODE_EDIT;
231
-        if ($show_mode) $mode = Builder::MODE_SHOW;
231
+        if ($show_mode) {
232
+            $mode = Builder::MODE_SHOW;
233
+        }
232 234
         $this->builder->setMode($mode);
233 235
         $this->builder->setResourceId($id);
234 236
 
Please login to merge, or discard this patch.
src/Form/Builder.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     /**
133 133
      * Returns builder is $mode.
134 134
      *
135
-     * @param $mode
135
+     * @param string $mode
136 136
      *
137 137
      * @return bool
138 138
      */
@@ -154,6 +154,7 @@  discard block
 block discarded – undo
154 154
     }
155 155
 
156 156
     /**
157
+     * @param integer $slice
157 158
      * @return string
158 159
      */
159 160
     public function getResource($slice = null)
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
      */
260 260
     public function field($name)
261 261
     {
262
-        return $this->fields()->first(function (Field $field) use ($name) {
262
+        return $this->fields()->first(function(Field $field) use ($name) {
263 263
             return $field->column() == $name;
264 264
         });
265 265
     }
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
             $this->form->model()->getUpdatedAtColumn(),
503 503
         ];
504 504
 
505
-        $this->fields = $this->fields()->reject(function (Field $field) use ($reservedColumns) {
505
+        $this->fields = $this->fields()->reject(function(Field $field) use ($reservedColumns) {
506 506
             return in_array($field->column(), $reservedColumns);
507 507
         });
508 508
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
     {
529 529
         $rules = [];
530 530
         foreach ($this->fields() as $item) {
531
-            if(!empty($item->getRules())){
531
+            if (!empty($item->getRules())) {
532 532
                 $rules[$item->id] = $item->getRules();
533 533
             }
534 534
         }
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
     public function getRuleMessages()
545 545
     {
546 546
         $rules = [];
547
-        foreach ($this->fields() as $item ) {
547
+        foreach ($this->fields() as $item) {
548 548
             foreach ($item->validationMessages as $key => $value) {
549 549
                 $rules[$key] = $value;
550 550
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -366,7 +366,9 @@
 block discarded – undo
366 366
      */
367 367
     public function title()
368 368
     {
369
-        if ($this->Title != "") return $this->Title;
369
+        if ($this->Title != "") {
370
+            return $this->Title;
371
+        }
370 372
 
371 373
         if ($this->mode == static::MODE_CREATE) {
372 374
             return trans('admin.create');
Please login to merge, or discard this patch.