1 | <?php |
||
8 | class Configuration |
||
9 | { |
||
10 | /** |
||
11 | * @var mixed |
||
12 | */ |
||
13 | protected $default; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $group; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $key; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $message; |
||
29 | |||
30 | /** |
||
31 | * @var string[] |
||
32 | */ |
||
33 | protected $messages = []; |
||
34 | |||
35 | /** |
||
36 | * @var AllOf |
||
37 | */ |
||
38 | protected $rules; |
||
39 | |||
40 | /** |
||
41 | * Constructor. |
||
42 | * |
||
43 | * @param AllOf|array $options |
||
44 | * @param string $key |
||
45 | * @param string $group |
||
46 | * @param string $default |
||
47 | */ |
||
48 | public function __construct($options, $key = null, $group = null, $default = null) |
||
62 | |||
63 | /** |
||
64 | * Gets the default value for non-existent request parameters, object properties or array keys. |
||
65 | * |
||
66 | * @return mixed |
||
67 | */ |
||
68 | public function getDefault() |
||
72 | |||
73 | /** |
||
74 | * Gets the group to use for errors and values storage. |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getGroup() |
||
82 | |||
83 | /** |
||
84 | * Gets the key to use for errors and values storage. |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getKey() |
||
92 | |||
93 | /** |
||
94 | * Gets the error message. |
||
95 | * |
||
96 | * @return string|null |
||
97 | */ |
||
98 | public function getMessage() |
||
102 | |||
103 | /** |
||
104 | * Gets individual rules messages. |
||
105 | * |
||
106 | * @return string[] |
||
107 | */ |
||
108 | public function getMessages() |
||
112 | |||
113 | /** |
||
114 | * Gets the validation rules. |
||
115 | * |
||
116 | * @return AllOf |
||
117 | */ |
||
118 | public function getValidationRules() |
||
122 | |||
123 | /** |
||
124 | * Tells whether a group has been set. |
||
125 | * |
||
126 | * @return bool |
||
127 | */ |
||
128 | public function hasGroup() |
||
132 | |||
133 | /** |
||
134 | * Tells whether a key has been set. |
||
135 | * |
||
136 | * @return bool |
||
137 | */ |
||
138 | public function hasKey() |
||
142 | |||
143 | /** |
||
144 | * Tells whether a single message has been set. |
||
145 | * |
||
146 | * @return bool |
||
147 | */ |
||
148 | public function hasMessage() |
||
152 | |||
153 | /** |
||
154 | * Tells whether individual rules messages have been set. |
||
155 | * |
||
156 | * @return bool |
||
157 | */ |
||
158 | public function hasMessages() |
||
162 | |||
163 | /** |
||
164 | * Sets the default value for non-existent request parameters, object properties or array keys. |
||
165 | * |
||
166 | * @param string $default |
||
167 | */ |
||
168 | public function setDefault($default) |
||
172 | |||
173 | /** |
||
174 | * Sets the group to use for errors and values storage. |
||
175 | * |
||
176 | * @param string $group |
||
177 | */ |
||
178 | public function setGroup($group) |
||
182 | |||
183 | /** |
||
184 | * Sets the key to use for errors and values storage. |
||
185 | * |
||
186 | * @param string $key |
||
187 | */ |
||
188 | public function setKey($key) |
||
192 | |||
193 | /** |
||
194 | * Sets the error message. |
||
195 | * |
||
196 | * @param string $message |
||
197 | */ |
||
198 | public function setMessage($message) |
||
202 | |||
203 | /** |
||
204 | * Sets individual rules messages. |
||
205 | * |
||
206 | * @param string[] $messages |
||
207 | */ |
||
208 | public function setMessages(array $messages) |
||
212 | |||
213 | /** |
||
214 | * Sets options from an array. |
||
215 | * |
||
216 | * @param array $options |
||
217 | */ |
||
218 | public function setOptions(array $options) |
||
235 | |||
236 | /** |
||
237 | * Sets the validation rules. |
||
238 | * |
||
239 | * @param AllOf $rules |
||
240 | */ |
||
241 | public function setValidationRules(AllOf $rules) |
||
245 | |||
246 | /** |
||
247 | * Verifies that all mandatory options are set and valid. |
||
248 | */ |
||
249 | public function validateOptions() |
||
259 | } |
||
260 |