Checkbox   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 1
A render() 0 4 1
1
<?php
2
3
namespace Aminetiyal\LaravelTemplate\Components\Lte\Field;
4
5
use Illuminate\View\Component;
6
use \Illuminate\Support\Str;
7
8
class Checkbox extends Component
9
{
10
    public $id;
11
    public $name;
12
    public $label;
13
    public $value;
14
    public $required;
15
    public $checked;
16
17
    public function __construct(
18
        $id = null,
19
        $name = null,
20
        $label = null,
21
        $value = null,
22
        $required = false,
23
        $checked = false
24
    )
25
    {
26
        $this->id = $id ?? 'field_checkbox_'.rand(100000, 99999);
27
        $this->name = $name ?? str_replace('-', '_', Str::kebab($label));
28
        $this->label = $label;
29
        $this->value = $value;
30
        $this->required = $required;
31
        $this->checked = $checked;
32
    }
33
34
    public function render()
35
    {
36
        return view('template::lte.components._fields.checkbox');
37
    }
38
}
39