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

Input::setPlaceholder()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6

Duplication

Lines 3
Ratio 50 %

Importance

Changes 0
Metric Value
dl 3
loc 6
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 0
1
<?php
2
3
namespace SoareCostin\BladeFormComponents\FormElements;
4
5
use SoareCostin\BladeFormComponents\FormElement;
6
7
class Input extends FormElement
8
{
9
    /** @var string */
10
    public $type = 'text';
11
12
    /** @var string */
13
    public $placeholder;
14
15
    /** @var array */
16
    public $attributesList = [
17
        'id', 'name', 'type', 'placeholder', 'value', 'class', 'required', 'disabled', 'readonly', 'autocomplete'
18
    ];
19
20
    protected function setSpecificAttributes()
21
    {
22
        $this->setPlaceholder();
23
    }
24
25
    protected function setPlaceholder()
26
    {
27 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...
28
            $this->placeholder = $this->params['placeholder'];
29
        }
30
    }
31
}