Passed
Pull Request — master (#721)
by Florian
09:26
created

SelectIcon::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 8
dl 0
loc 15
rs 10

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Components;
4
5
use Illuminate\View\Component;
6
7
class SelectIcon extends Component
8
{
9
    public $id, $name, $label;
10
    public $topclass, $inputclass;
11
    public $disabled, $required, $multiple;
12
13
    public function __construct(
14
            $id, $name = null,
15
            $label = 'Input Label',
16
            $topclass = null, $inputclass = null,
17
            $disabled = false, $required = false, $multiple = false
18
        )
19
    {
20
        $this->id = $id;
21
        $this->name = $name;
22
        $this->label = $label;
23
        $this->topclass = $topclass;
24
        $this->inputclass = $inputclass;
25
        $this->required = $required;
26
        $this->disabled = $disabled;
27
        $this->multiple = $multiple;
28
    }
29
30
    public function render()
31
    {
32
        return view('adminlte::select-icon');
33
    }
34
}