These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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 Zend\Filter\StringTrim; |
||
12 | use Zend\Filter\StripTags; |
||
13 | |||
14 | View Code Duplication | class Text extends FieldAbstract |
|
0 ignored issues
–
show
|
|||
15 | { |
||
16 | /** |
||
17 | * @return string |
||
18 | */ |
||
19 | 10 | public function getTag() |
|
20 | { |
||
21 | 10 | return 'input'; |
|
22 | } |
||
23 | |||
24 | |||
25 | 19 | public function init() |
|
26 | { |
||
27 | 19 | $this->setAttribute('type', 'text'); |
|
28 | 19 | $this->setAttribute('class', 'form-control'); |
|
29 | 19 | $stringTrim = new FilterAdapterZf(new StringTrim()); |
|
30 | 19 | $stripTags = new FilterAdapterZf(new StripTags()); |
|
31 | 19 | $this->addFilter($stringTrim) |
|
32 | 19 | ->addFilter($stripTags); |
|
33 | 19 | } |
|
34 | |||
35 | /** |
||
36 | * @return string |
||
37 | */ |
||
38 | 1 | public function getPlaceholder() |
|
39 | { |
||
40 | 1 | return $this->getAttribute('placeholder'); |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * @param string $placeholder |
||
45 | */ |
||
46 | 3 | public function setPlaceholder($placeholder) |
|
47 | { |
||
48 | 3 | $this->setAttribute('placeholder', $placeholder); |
|
49 | } |
||
50 | } |
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.