1 | <?php |
||
22 | class Configuration |
||
23 | { |
||
24 | /** |
||
25 | * @var mixed |
||
26 | */ |
||
27 | protected $default; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $group; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $key; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $message; |
||
43 | |||
44 | /** |
||
45 | * @var string[] |
||
46 | */ |
||
47 | protected $messages = []; |
||
48 | |||
49 | /** |
||
50 | * @var AllOf |
||
51 | */ |
||
52 | protected $rules; |
||
53 | |||
54 | /** |
||
55 | * Constructor. |
||
56 | * |
||
57 | * @param AllOf|array $options |
||
58 | * @param string $key |
||
59 | * @param string $group |
||
60 | * @param string $default |
||
61 | */ |
||
62 | public function __construct($options, string $key = null, string $group = null, $default = null) |
||
76 | |||
77 | /** |
||
78 | * Gets the default value for non-existent request parameters, object properties or array keys. |
||
79 | * |
||
80 | * @return mixed |
||
81 | */ |
||
82 | public function getDefault() |
||
86 | |||
87 | /** |
||
88 | * Gets the group to use for errors and values storage. |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | public function getGroup() |
||
96 | |||
97 | /** |
||
98 | * Gets the key to use for errors and values storage. |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getKey() |
||
106 | |||
107 | /** |
||
108 | * Gets the error message. |
||
109 | * |
||
110 | * @return string|null |
||
111 | */ |
||
112 | public function getMessage() |
||
116 | |||
117 | /** |
||
118 | * Gets individual rules messages. |
||
119 | * |
||
120 | * @return string[] |
||
121 | */ |
||
122 | public function getMessages(): array |
||
126 | |||
127 | /** |
||
128 | * Gets the validation rules. |
||
129 | * |
||
130 | * @return AllOf |
||
131 | */ |
||
132 | public function getValidationRules(): AllOf |
||
136 | |||
137 | /** |
||
138 | * Tells whether a group has been set. |
||
139 | * |
||
140 | * @return bool |
||
141 | */ |
||
142 | public function hasGroup(): bool |
||
146 | |||
147 | /** |
||
148 | * Tells whether a key has been set. |
||
149 | * |
||
150 | * @return bool |
||
151 | */ |
||
152 | public function hasKey(): bool |
||
156 | |||
157 | /** |
||
158 | * Tells whether a single message has been set. |
||
159 | * |
||
160 | * @return bool |
||
161 | */ |
||
162 | public function hasMessage(): bool |
||
166 | |||
167 | /** |
||
168 | * Tells whether individual rules messages have been set. |
||
169 | * |
||
170 | * @return bool |
||
171 | */ |
||
172 | public function hasMessages(): bool |
||
176 | |||
177 | /** |
||
178 | * Sets the default value for non-existent request parameters, object properties or array keys. |
||
179 | * |
||
180 | * @param mixed $default |
||
181 | */ |
||
182 | public function setDefault($default) |
||
186 | |||
187 | /** |
||
188 | * Sets the group to use for errors and values storage. |
||
189 | * |
||
190 | * @param string $group |
||
191 | */ |
||
192 | public function setGroup(string $group) |
||
196 | |||
197 | /** |
||
198 | * Sets the key to use for errors and values storage. |
||
199 | * |
||
200 | * @param string $key |
||
201 | */ |
||
202 | public function setKey(string $key) |
||
206 | |||
207 | /** |
||
208 | * Sets the error message. |
||
209 | * |
||
210 | * @param string $message |
||
211 | */ |
||
212 | public function setMessage(string $message) |
||
216 | |||
217 | /** |
||
218 | * Sets individual rules messages. |
||
219 | * |
||
220 | * @param string[] $messages |
||
221 | */ |
||
222 | public function setMessages(array $messages) |
||
226 | |||
227 | /** |
||
228 | * Sets options from an array. |
||
229 | * |
||
230 | * @param array $options |
||
231 | */ |
||
232 | public function setOptions(array $options) |
||
249 | |||
250 | /** |
||
251 | * Sets the validation rules. |
||
252 | * |
||
253 | * @param AllOf $rules |
||
254 | */ |
||
255 | public function setValidationRules(AllOf $rules) |
||
259 | |||
260 | /** |
||
261 | * Verifies that all mandatory options are set and valid. |
||
262 | */ |
||
263 | public function validateOptions() |
||
277 | } |
||
278 |