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

Select::setOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 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
}