Textarea::setRows()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
eloc 1
c 3
b 1
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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