Completed
Push — master ( 839e9e...4e091b )
by Costin
03:53
created

Textarea::setSpecificAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
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
    /** @var array */
16
    public $attributesList = [
17
        'id', 'name', 'placeholder', 'rows', 'class', 'required', 'disabled', 'readonly', 'autocomplete'
18
    ];
19
20
    protected function setSpecificAttributes()
21
    {
22
        $this->setPlaceholder();
23
        $this->setRows();
24
    }
25
26
    protected function setPlaceholder()
27
    {
28 View Code Duplication
        if (isset($this->params['placeholder']) && !empty($this->params['placeholder'])) {
1 ignored issue
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
            $this->placeholder = $this->params['placeholder'];
30
        }
31
    }
32
33
    protected function setRows()
34
    {
35 View Code Duplication
        if (isset($this->params['rows']) && !empty($this->params['rows'])) {
1 ignored issue
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
            $this->rows = $this->params['rows'];
37
        }
38
    }
39
}