Select::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 10
dl 0
loc 11
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0

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\View\Components\Form;
4
5
class Select extends InputGroupComponent
6
{
7
    use Traits\OldValueSupportTrait;
8
9
    /**
10
     * Create a new component instance.
11
     *
12
     * @return void
13
     */
14 3
    public function __construct(
15
        $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
16
        $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
17
        $errorKey = null, $enableOldSupport = null
18
    ) {
19 3
        parent::__construct(
20 3
            $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
21 3
            $igroupClass, $disableFeedback, $errorKey
22 3
        );
23
24 3
        $this->enableOldSupport = isset($enableOldSupport);
25
    }
26
27
    /**
28
     * Get the view / contents that represent the component.
29
     *
30
     * @return \Illuminate\View\View|string
31
     */
32 1
    public function render()
33
    {
34 1
        return view('adminlte::components.form.select');
35
    }
36
}
37