Textarea   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 26 2
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 Textarea extends Component
9
{
10
    public $type;
11
    public $name;
12
    public $placeholder;
13
    public $label;
14
    public $cols;
15
    public $rows;
16
    public $value;
17
    public $class;
18
    public $readonly;
19
    public $required;
20
    public $icon;
21
22
    public function __construct(
23
        $type = 'text',
24
        $name = null,
25
        $placeholder = null,
26
        $label = null,
27
        $cols = null,
28
        $rows = null,
29
        $value = null,
30
        $class = null,
31
        $readonly = null,
32
        $required = false,
33
        $icon = null
34
    )
35
    {
36
        $this->type = $type;
37
        $this->name = $name ?? str_replace('-', '_', Str::kebab($label));
38
        $this->placeholder = $placeholder ?? (!$name ? str_replace('-', '_', Str::kebab($label)) : '');
39
        $this->label = $label;
40
        $this->cols = $cols;
41
        $this->rows = $rows;
42
        $this->value = old($this->name, ($value ?? ''));
43
        $this->class = $class;
44
        $this->readonly = $readonly;
45
        $this->required = $required;
46
        $this->icon = $icon;
47
    }
48
49
50
    public function render()
51
    {
52
        return view('template::lte.components._fields.textarea');
53
    }
54
}
55