Passed
Push — master ( acf3f9...98cfe3 )
by Derek Stephen
03:04
created

TextArea::setPlaceholder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Del\Form\Field;
4
5
use Del\Form\Filter\Adapter\FilterAdapterZf;
6
use Del\Form\Renderer\Field\TextAreaRender;
7
use Laminas\Filter\StringTrim;
8
use Laminas\Filter\StripTags;
9
10
class TextArea extends FieldAbstract
11
{
12
    /**
13
     * @return string
14
     */
15 1
    public function getTag(): string
16
    {
17 1
        return 'textarea';
18
    }
19
20
21 1
    public function init()
22
    {
23 1
        $this->setAttribute('type', 'text');
24 1
        $this->setAttribute('class', 'form-control');
25 1
        $stringTrim = new FilterAdapterZf(new StringTrim());
26 1
        $stripTags = new FilterAdapterZf(new StripTags());
27 1
        $this->addFilter($stringTrim);
28 1
        $this->addFilter($stripTags);
29 1
        $this->setRenderer(new TextAreaRender());
30 1
    }
31
32
    /**
33
     * @return string
34
     */
35 1
    public function getPlaceholder(): string
36
    {
37 1
        return $this->getAttribute('placeholder');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getAttribute('placeholder') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
38
    }
39
40
    /**
41
     * @param string $placeholder
42
     */
43 1
    public function setPlaceholder(string $placeholder): void
44
    {
45 1
        $this->setAttribute('placeholder', $placeholder);
46
    }
47
}