Passed
Push — master ( d5d794...b1bf4d )
by Pascal
12:05
created

FormRange::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 17
rs 10
cc 2
nc 2
nop 6
1
<?php
2
3
namespace ProtoneMedia\LaravelFormComponents\Components;
4
5
class FormRange extends Component
6
{
7
    use HandlesValidationErrors;
8
    use HandlesDefaultAndOldValue;
9
10
    public string $name;
11
    public string $label;
12
13
    public $value;
14
15
    /**
16
     * Create a new component instance.
17
     *
18
     * @return void
19
     */
20
    public function __construct(
21
        string $name,
22
        string $label = '',
23
        $bind = null,
24
        $default = null,
25
        $language = null,
26
        bool $showErrors = true
27
    ) {
28
        $this->name       = $name;
29
        $this->label      = $label;
30
        $this->showErrors = $showErrors;
31
32
        if ($language) {
33
            $this->name = "{$name}[{$language}]";
34
        }
35
36
        $this->setValue($name, $bind, $default, $language);
37
    }
38
}
39