Completed
Branch master (312f5c)
by Derek Stephen
03:48 queued 01:34
created

TextArea   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 5
dl 38
loc 38
ccs 16
cts 16
cp 1
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getTag() 4 4 1
A init() 10 10 1
A setPlaceholder() 4 4 1
A getPlaceholder() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 1
    public function getTag()
21
    {
22 1
        return 'textarea';
23
    }
24
25
26 1
    public function init()
27
    {
28 1
        $this->setAttribute('type', 'text');
29 1
        $this->setAttribute('class', 'form-control');
30 1
        $stringTrim = new FilterAdapterZf(new StringTrim());
31 1
        $stripTags = new FilterAdapterZf(new StripTags());
32 1
        $this->addFilter($stringTrim)
33 1
            ->addFilter($stripTags);
34 1
        $this->setRenderer(new TextAreaRender());
35 1
    }
36
37
    /**
38
     * @return string
39
     */
40 1
    public function getPlaceholder()
41
    {
42 1
        return $this->getAttribute('placeholder');
43
    }
44
45
    /**
46
     * @param string $placeholder
47
     */
48 1
    public function setPlaceholder($placeholder)
49
    {
50 1
        $this->setAttribute('placeholder', $placeholder);
51
    }
52
}