Select   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 34
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 8 2
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\Input;
11
12
use Slick\Form\Element\ChoiceAwareElementInterface;
13
use Slick\Form\Element\ChoiceAwareElementMethods;
14
use Slick\Form\InputInterface;
15
use Slick\Form\Renderer\Select as SelectRenderer;
16
17
/**
18
 * Select input
19
 *
20
 * @package Slick\Form\Input
21
 * @author  Filipe Silva <[email protected]>
22
 */
23
class Select extends AbstractInput implements
24
    InputInterface,
25
    ChoiceAwareElementInterface
26
{
27
28
    /**
29
     * ChoiceAwareElementInterface implementation methods
30
     */
31
    use ChoiceAwareElementMethods;
32
33
    /**
34
     * @var string Renderer class
35
     */
36
    protected $rendererClass = SelectRenderer::class;
37
38
    /**
39
     * Adds the value to the select
40
     *
41
     * Mainly it removes the entry in the attributes list
42
     *
43
     * @param mixed $value
44
     *
45
     * @return $this|self|Select
46
     */
47 4
    public function setValue($value)
48
    {
49 4
        parent::setValue($value);
50 4
        if ($this->hasAttribute('value')) {
51
            $this->getAttributes()->remove('value');
52
        }
53 4
        return $this;
54
    }
55
56
}