Completed
Push — master ( 23a2fd...514aec )
by Pavel
02:50
created

Option   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 190
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 15
c 4
b 0
f 1
lcom 1
cbo 1
dl 0
loc 190
rs 10

14 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getValue() 0 4 1
A endOption() 0 4 1
A setTitle() 0 6 1
A getTitle() 0 4 1
A setClass() 0 10 2
A getClass() 0 4 1
A setClassSecondary() 0 4 1
A getClassSecondary() 0 4 1
A setClassInDropdown() 0 4 1
A getClassInDropdown() 0 4 1
A setIcon() 0 6 1
A getIcon() 0 4 1
A getText() 0 4 1
1
<?php
2
3
/**
4
 * @copyright   Copyright (c) 2015 ublaboo <[email protected]>
5
 * @author      Pavel Janda <[email protected]>
6
 * @package     Ublaboo
7
 */
8
9
namespace Ublaboo\DataGrid\Status;
10
11
use Nette;
12
use Ublaboo\DataGrid\Column\ColumnStatus;
13
14
class Option extends Nette\Object
15
{
16
17
	/**
18
	 * @var ColumnStatus
19
	 */
20
	protected $columnStatus;
21
22
	/**
23
	 * @var mixed
24
	 */
25
	protected $value;
26
27
	/**
28
	 * @var string
29
	 */
30
	protected $text;
31
32
	/**
33
	 * @var string|callable
34
	 */
35
	protected $title;
36
37
	/**
38
	 * @var string|callable
39
	 */
40
	protected $class = 'btn-success';
41
42
	/**
43
	 * @var string
44
	 */
45
	protected $class_secondary = 'btn btn-xs';
46
47
	/**
48
	 * @var string
49
	 */
50
	protected $class_in_dropdown = 'ajax';
51
52
	/**
53
	 * @var string|callable
54
	 */
55
	protected $icon;
56
57
58
	/**
59
	 * [__construct description]
60
	 * @param ColumnStatus $columnStatus
61
	 * @param mixed       $value
62
	 * @param string       $text
63
	 */
64
	public function __construct(ColumnStatus $columnStatus, $value, $text)
65
	{
66
		$this->columnStatus = $columnStatus;
67
		$this->value = $value;
68
		$this->text = (string) $text;
69
	}
70
71
72
	/**
73
	 * @return mixed
74
	 */
75
	public function getValue()
76
	{
77
		return $this->value;
78
	}
79
80
81
	/**
82
	 * End option fluent interface and return parent
83
	 * @return ColumnStatus
84
	 */
85
	public function endOption()
86
	{
87
		return $this->columnStatus;
88
	}
89
90
91
	/**
92
	 * @param string $title
93
	 * @return static
94
	 */
95
	public function setTitle($title)
96
	{
97
		$this->title = (string) $title;
98
99
		return $this;
100
	}
101
102
103
	/**
104
	 * @return string
105
	 */
106
	public function getTitle()
107
	{
108
		return $this->title;
109
	}
110
111
112
	/**
113
	 * @param string $class
114
	 * @param string $class_secondary
115
	 * @return static
116
	 */
117
	public function setClass($class, $class_secondary = NULL)
118
	{
119
		$this->class = (string) $class;
120
121
		if ($class_secondary !== NULL) {
122
			$this->class_secondary = (string) $class_secondary;
123
		}
124
125
		return $this;
126
	}
127
128
129
	/**
130
	 * @return string
131
	 */
132
	public function getClass()
133
	{
134
		return $this->class;
135
	}
136
137
138
	/**
139
	 * @param string $class_secondary
140
	 */
141
	public function setClassSecondary($class_secondary)
142
	{
143
		$this->class_secondary = (string) $class_secondary;
144
	}
145
146
147
	/**
148
	 * @return string
149
	 */
150
	public function getClassSecondary()
151
	{
152
		return $this->class_secondary;
153
	}
154
155
156
	/**
157
	 * @param string $class_in_dropdown
158
	 */
159
	public function setClassInDropdown($class_in_dropdown)
160
	{
161
		$this->class_in_dropdown = (string) $class_in_dropdown;
162
	}
163
164
165
	/**
166
	 * @return string
167
	 */
168
	public function getClassInDropdown()
169
	{
170
		return $this->class_in_dropdown;
171
	}
172
173
174
	/**
175
	 * @param string $icon
176
	 * @return static
177
	 */
178
	public function setIcon($icon)
179
	{
180
		$this->icon = (string) $icon;
181
182
		return $this;
183
	}
184
185
186
	/**
187
	 * @return string
188
	 */
189
	public function getIcon()
190
	{
191
		return $this->icon;
192
	}
193
194
195
	/**
196
	 * @return string
197
	 */
198
	public function getText()
199
	{
200
		return $this->text;
201
	}
202
203
}
204