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

TextArea   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
c 2
b 0
f 0
dl 0
loc 36
ccs 15
cts 15
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getTag() 0 3 1
A getPlaceholder() 0 3 1
A init() 0 9 1
A setPlaceholder() 0 3 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
}