Completed
Push — master ( 797ef7...545216 )
by wen
13:55
created

ElSwitch::setText()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 3
nc 1
nop 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A ElSwitch::getTexts() 0 4 1
1
<?php
2
3
namespace Sco\Admin\Form\Elements;
4
5
class ElSwitch extends NamedElement
6
{
7
    protected $type = 'elswitch';
8
9
    protected $texts       = ['ON', 'OFF'];
10
    protected $values      = ['yes', 'no'];
11
    protected $colors      = [];
12
    protected $iconClasses = [];
13
14
    protected $width = 40;
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
    /**
34
     * @param $active
35
     * @param $inactive
36
     *
37
     * @return ElSwitch
38
     */
39
    public function setValues($active, $inactive)
40
    {
41
        $this->values = [$active, $inactive];
42
43
        return $this;
44
    }
45
46
    public function getTexts()
47
    {
48
        return $this->texts;
49
    }
50
51
    /**
52
     * @param $active
53
     * @param $inactive
54
     *
55
     * @return ElSwitch
56
     */
57
    public function setTexts($active, $inactive)
58
    {
59
        $this->texts = [$active, $inactive];
60
61
        return $this;
62
    }
63
64
    public function getColors()
65
    {
66
        return $this->colors;
67
    }
68
69
    /**
70
     * @param $active
71
     * @param $inactive
72
     *
73
     * @return ElSwitch
74
     */
75
    public function setColors($active, $inactive)
76
    {
77
        $this->colors = [$active, $inactive];
78
79
        return $this;
80
    }
81
82
    public function getIconClasses()
83
    {
84
        return $this->iconClasses;
85
    }
86
87
    public function setIconClasses($active, $inactive)
88
    {
89
        $this->iconClasses = [$active, $inactive];
90
91
        return $this;
92
    }
93
94
    public function toArray()
95
    {
96
        return parent::toArray() + [
97
                'texts'       => $this->getTexts(),
98
                'values'      => $this->getValues(),
99
                'colors'      => $this->getColors(),
100
                'iconClasses' => $this->getIconClasses(),
101
                'width'       => $this->getWidth(),
102
            ];
103
    }
104
}
105