1 | <?php |
||
17 | class Filter |
||
18 | { |
||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $name; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $type; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $label; |
||
33 | |||
34 | /** |
||
35 | * @var boolean |
||
36 | */ |
||
37 | private $enabled = true; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | private $template; |
||
43 | |||
44 | /** |
||
45 | * @var array |
||
46 | */ |
||
47 | private $options = []; |
||
48 | |||
49 | /** |
||
50 | * @var array |
||
51 | */ |
||
52 | private $formOptions = []; |
||
53 | |||
54 | /** |
||
55 | * @var mixed |
||
56 | */ |
||
57 | private $criteria; |
||
58 | |||
59 | /** |
||
60 | * @var int |
||
61 | * |
||
62 | * Position equals to 100 to ensure that wile sorting filters by position ASC |
||
63 | * the filters positioned by default will be last |
||
64 | */ |
||
65 | private $position = 100; |
||
66 | |||
67 | /** |
||
68 | * @param string $name |
||
69 | * @param string $type |
||
70 | */ |
||
71 | private function __construct($name, $type) |
||
78 | |||
79 | /** |
||
80 | * @param string $name |
||
81 | * @param string $type |
||
82 | * |
||
83 | * @return self |
||
84 | */ |
||
85 | public static function fromNameAndType($name, $type) |
||
89 | |||
90 | /** |
||
91 | * @return string |
||
92 | */ |
||
93 | public function getName() |
||
97 | |||
98 | /** |
||
99 | * @return string |
||
100 | */ |
||
101 | public function getType() |
||
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getLabel() |
||
113 | |||
114 | /** |
||
115 | * @param string $label |
||
116 | */ |
||
117 | public function setLabel($label) |
||
121 | |||
122 | /** |
||
123 | * @return boolean |
||
124 | */ |
||
125 | public function isEnabled() |
||
129 | |||
130 | /** |
||
131 | * @param boolean $enabled |
||
132 | */ |
||
133 | public function setEnabled($enabled) |
||
137 | |||
138 | /** |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getTemplate() |
||
145 | |||
146 | /** |
||
147 | * @param string $template |
||
148 | */ |
||
149 | public function setTemplate($template) |
||
153 | |||
154 | /** |
||
155 | * @return array |
||
156 | */ |
||
157 | public function getOptions() |
||
161 | |||
162 | /** |
||
163 | * @param array $options |
||
164 | */ |
||
165 | public function setOptions($options) |
||
169 | |||
170 | /** |
||
171 | * @return array |
||
172 | */ |
||
173 | public function getFormOptions() |
||
177 | |||
178 | /** |
||
179 | * @param array $formOptions |
||
180 | */ |
||
181 | public function setFormOptions($formOptions) |
||
185 | |||
186 | /** |
||
187 | * @return int |
||
188 | */ |
||
189 | public function getPosition() |
||
193 | |||
194 | /** |
||
195 | * @param int $position |
||
196 | */ |
||
197 | public function setPosition($position) |
||
201 | |||
202 | /** |
||
203 | * @return mixed |
||
204 | */ |
||
205 | public function getCriteria() |
||
209 | |||
210 | /** |
||
211 | * @param mixed $criteria |
||
212 | */ |
||
213 | public function setCriteria($criteria) |
||
217 | } |
||
218 |