Completed
Push — master ( 077dd8...ca59d5 )
by Derek Stephen
01:55
created

Select   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 58
ccs 17
cts 17
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getTag() 0 4 1
A init() 0 6 1
A getOptions() 0 4 1
A setOptions() 0 5 1
A getOption() 0 4 1
A setOption() 0 5 1
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 05/12/2016
5
 * Time: 00:57
6
 */
7
8
namespace Del\Form\Field;
9
10
use Del\Form\Renderer\Field\SelectRender;
11
12
class Select extends FieldAbstract
13
{
14
    /** @var array $options */
15
    private $options = [];
16
17
    /**
18
     * @return string
19
     */
20 2
    public function getTag()
21
    {
22 2
        return 'select';
23
    }
24
25
26 2
    public function init()
27
    {
28 2
        $this->setAttribute('type', 'text');
29 2
        $this->setAttribute('class', 'form-control');
30 2
        $this->setRenderer(new SelectRender());
31 2
    }
32
33
    /**
34
     * @return array
35
     */
36 2
    public function getOptions()
37
    {
38 2
        return $this->options;
39
    }
40
41
    /**
42
     * @param array $options
43
     * @return $this
44
     */
45 1
    public function setOptions($options)
46
    {
47 1
        $this->options = $options;
48 1
        return $this;
49
    }
50
51
    /**
52
     * @return array
53
     */
54 1
    public function getOption($key)
55
    {
56 1
        return $this->options[$key];
57
    }
58
59
    /**
60
     * @param $key
61
     * @param $value
62
     * @return $this
63
     */
64 1
    public function setOption($key, $value)
65
    {
66 1
        $this->options[$key] = $value;
67 1
        return $this;
68
    }
69
}