Button::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\View\Components\Form;
4
5
use Illuminate\View\Component;
6
use JeroenNoten\LaravelAdminLte\Helpers\UtilsHelper;
7
8
class Button extends Component
9
{
10
    /**
11
     * The visible label (text) for the button.
12
     *
13
     * @var string
14
     */
15
    public $label;
16
17
    /**
18
     * The button type ('button', 'submit', 'reset'). Similar to the html type
19
     * attribute but with a default value.
20
     *
21
     * @var string
22
     */
23
    public $type;
24
25
    /**
26
     * The button style theme. One of the available AdminLTE theme: primary,
27
     * secondary, info, warning, danger, success, dark, etc.
28
     *
29
     * @var string
30
     */
31
    public $theme;
32
33
    /**
34
     * A fontawesome icon for the button.
35
     *
36
     * @var string
37
     */
38
    public $icon;
39
40
    /**
41
     * Create a new component instance.
42
     *
43
     * @return void
44
     */
45 1
    public function __construct(
46
        $label = null, $type = 'button', $theme = 'default', $icon = null
47
    ) {
48 1
        $this->label = UtilsHelper::applyHtmlEntityDecoder($label);
49 1
        $this->type = $type;
50 1
        $this->theme = $theme;
51 1
        $this->icon = $icon;
52
    }
53
54
    /**
55
     * Get the view / contents that represent the component.
56
     *
57
     * @return \Illuminate\View\View|string
58
     */
59 1
    public function render()
60
    {
61 1
        return view('adminlte::components.form.button');
62
    }
63
}
64