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

InputSlider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 16
c 1
b 0
f 0
nc 1
nop 16
dl 0
loc 26
rs 9.7333

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 InputSlider extends Component
8
{
9
    public $id, $name, $label;
10
    public $topclass, $inputclass;
11
    public $value, $disabled, $required;
12
    public $min, $max, $step, $vertical;
13
    public $tick, $ticks, $tickLabels;
14
    public $color;
15
16
    public function __construct(
17
            $id, $name = null,
18
            $label = 'Input Label',
19
            $topclass = null, $inputclass = null,
20
            $value = null,$disabled = false, $required = false,
21
            $min = 0, $max = 100, $step = 1, $vertical = false,
22
            $tick = false, $ticks = null,  $tickLabels = null,
23
            $color = 'blue'
24
        )
25
    {
26
        $this->id = $id;
27
        $this->name = $name;
28
        $this->label = $label;
29
        $this->topclass = $topclass;
30
        $this->inputclass = $inputclass;
31
        $this->required = $required;
32
        $this->disabled = $disabled;
33
        $this->value = $value;
34
        $this->min = $min;
35
        $this->max = $max;
36
        $this->step = $step;
37
        $this->vertical = $vertical;
38
        $this->tick = $tick;
39
        $this->ticks = $ticks;
40
        $this->tickLabels = $tickLabels;
41
        $this->color = $color;
42
    }
43
44
    public function render()
45
    {
46
        return view('adminlte::input-slider');
47
    }
48
}