Passed
Pull Request — master (#721)
by Florian
14:00 queued 04:02
created

InputFile::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

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

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 InputFile extends Component
8
{
9
    public $id;
10
    public $name;
11
    public $label;
12
    public $placeholder;
13
    public $topclass;
14
    public $inputclass;
15
    public $disabled;
16
    public $required;
17
    public $multiple;
18
19
    public function __construct(
20
            $id = null, $name = null,
21
            $label = 'Input Label', $placeholder = null,
22
            $topclass = null, $inputclass = null,
23
            $disabled = false, $required = false, $multiple = false
24
        ) {
25
        $this->id = $id;
26
        $this->name = $name;
27
        $this->label = $label;
28
        $this->placeholder = $placeholder;
29
        $this->topclass = $topclass;
30
        $this->inputclass = $inputclass;
31
        $this->required = $required;
32
        $this->disabled = $disabled;
33
        $this->multiple = $multiple;
34
    }
35
36
    public function render()
37
    {
38
        return view('adminlte::input-file');
39
    }
40
}
41