Completed
Push — master ( 47cdc0...d913d0 )
by Derek Stephen
01:54
created

TextArea::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 10
loc 10
ccs 0
cts 10
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 19/11/2016
5
 * Time: 21:37
6
 */
7
8
namespace Del\Form\Field;
9
10
use Del\Form\Filter\Adapter\FilterAdapterZf;
11
use Del\Form\Renderer\Field\TextAreaRender;
12
use Zend\Filter\StringTrim;
13
use Zend\Filter\StripTags;
14
15 View Code Duplication
class TextArea extends FieldAbstract
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in 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...
16
{
17
    /**
18
     * @return string
19
     */
20
    public function getTag()
21
    {
22
        return 'textarea';
23
    }
24
25
26
    public function init()
27
    {
28
        $this->setAttribute('type', 'text');
29
        $this->setAttribute('class', 'form-control');
30
        $stringTrim = new FilterAdapterZf(new StringTrim());
31
        $stripTags = new FilterAdapterZf(new StripTags());
32
        $this->addFilter($stringTrim)
33
            ->addFilter($stripTags);
34
        $this->setRenderer(new TextAreaRender());
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getPlaceholder()
41
    {
42
        return $this->getAttribute('placeholder');
43
    }
44
45
    /**
46
     * @param string $placeholder
47
     */
48
    public function setPlaceholder($placeholder)
49
    {
50
        $this->setAttribute('placeholder', $placeholder);
51
    }
52
}