Completed
Push — master ( ad129c...1d4a66 )
by Filipe
16:47
created

Select   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 21
loc 21
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 7 7 2

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
/**
4
 * This file is part of slick/form package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Form\Renderer;
11
12
/**
13
 * HTML Select renderer
14
 *
15
 * @package Slick\Form\Renderer
16
 */
17 View Code Duplication
class Select extends Input
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...
18
{
19
20
    /**
21
     * @var string The template file to use in the rendering
22
     */
23
    public $template = 'form-inputs/select.twig';
24
25
    /**
26
     * Overrides to remove the unnecessary value attribute
27
     * @param array $context
28
     * @return string
29
     */
30 2
    public function render($context = [])
31
    {
32 2
        if ($this->getElement()->hasAttribute('value')) {
33 2
            $this->getElement()->getAttributes()->remove('value');
34 1
        }
35 2
        return parent::render($context);
36
    }
37
}