Completed
Push — master ( 2bde54...385f57 )
by wen
16:28
created

ElSwitch::getWidth()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Sco\Admin\Form\Elements;
4
5
class ElSwitch extends NamedElement
6
{
7
    protected $type = 'elswitch';
8
9
    protected $text      = ['ON', 'OFF'];
10
    protected $values    = ['yes', 'no'];
11
    protected $color     = [];
12
    protected $iconClass = [];
13
14
    protected $width = 58;
15
16
    public function getWidth()
17
    {
18
        return $this->width;
19
    }
20
21
    public function setWidth($value)
22
    {
23
        $this->width = intval($value);
24
25
        return $this;
26
    }
27
28
    public function getValues()
29
    {
30
        return $this->values;
31
    }
32
33
    public function setValues($on, $off)
34
    {
35
        $this->values = [$on, $off];
36
37
        return $this;
38
    }
39
40
    public function getText()
41
    {
42
        return $this->text;
43
    }
44
45
    public function setText($on, $off)
46
    {
47
        $this->text = [$on, $off];
48
49
        return $this;
50
    }
51
52
    public function getColor()
53
    {
54
        return $this->color;
55
    }
56
57
    public function setColor($on, $off)
58
    {
59
        $this->color = [$on, $off];
60
61
        return $this;
62
    }
63
64
    public function getIconClass()
65
    {
66
        return $this->iconClass;
67
    }
68
69
    public function setIconClass($on, $off)
70
    {
71
        $this->iconClass = [$on, $off];
72
73
        return $this;
74
    }
75
76
    public function toArray()
77
    {
78
        return parent::toArray() + [
79
                'text'      => $this->getText(),
80
                'values'    => $this->getValues(),
81
                'color'     => $this->getColor(),
82
                'iconClass' => $this->getIconClass(),
83
                'width'     => $this->getWidth(),
84
            ];
85
    }
86
}
87