Textarea   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 5
Bugs 1 Features 1
Metric Value
wmc 5
eloc 11
c 5
b 1
f 1
dl 0
loc 35
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setSpecificAttributes() 0 4 1
A attributesList() 0 4 1
A setPlaceholder() 0 3 1
A setRows() 0 3 1
A setStyles() 0 4 1
1
<?php
2
3
namespace SoareCostin\BladeFormComponents\FormElements;
4
5
use SoareCostin\BladeFormComponents\FormElement;
6
7
class Textarea extends FormElement
8
{
9
    /** @var string */
10
    public $placeholder;
11
12
    /** @var int */
13
    public $rows = 5;
14
15
    protected function attributesList()
16
    {
17
        return [
18
            'id', 'name', 'placeholder', 'rows', 'class', 'required', 'disabled', 'readonly', 'autocomplete',
19
        ];
20
    }
21
22
    protected function setSpecificAttributes()
23
    {
24
        $this->setPlaceholder();
25
        $this->setRows();
26
    }
27
28
    protected function setPlaceholder()
29
    {
30
        $this->placeholder = $this->params->get('placeholder');
31
    }
32
33
    protected function setRows()
34
    {
35
        $this->rows = $this->params->get('rows');
36
    }
37
38
    protected function setStyles()
39
    {
40
        $this->class[] = config('blade-form-components.themes.'.$this->getTheme().'.fields.textarea') ?? config('blade-form-components.themes.'.$this->getTheme().'.fields.default');
41
        $this->labelClass[] = config('blade-form-components.themes.'.$this->getTheme().'.labels.default');
42
    }
43
}
44