1 | <?php |
||
14 | class JsonSchema extends AbstractValidator |
||
15 | { |
||
16 | /** @var string */ |
||
17 | private $file; |
||
18 | |||
19 | /** @var string[] */ |
||
20 | private $messages = array(); |
||
21 | |||
22 | /** @var string[] */ |
||
23 | private $errorKeys = array(); |
||
24 | |||
25 | /** @var string */ |
||
26 | private $messagePrefix = '['; |
||
27 | |||
28 | /** @var string */ |
||
29 | private $messageSuffix = ']'; |
||
30 | |||
31 | /** @var string */ |
||
32 | private $messageAttributeDelimiter = '] ['; |
||
33 | |||
34 | /** |
||
35 | * JsonSchema constructor. |
||
36 | * @param array|null|\Traversable $options |
||
37 | */ |
||
38 | public function __construct($options = null) |
||
48 | |||
49 | /** |
||
50 | * Returns true if and only if $value meets the validation requirements |
||
51 | * |
||
52 | * If $value fails validation, then this method returns false, and |
||
53 | * getMessages() will return an array of messages that explain why the |
||
54 | * validation failed. |
||
55 | * |
||
56 | * @param mixed $value |
||
57 | * @return bool |
||
58 | * @throws Exception\RuntimeException If validation of $value is impossible |
||
59 | */ |
||
60 | public function isValid($value) |
||
84 | |||
85 | /** |
||
86 | * @param mixed[] $error |
||
87 | * @return string |
||
88 | */ |
||
89 | public function formatError(array $error) |
||
100 | |||
101 | /** |
||
102 | * @return \stdClass |
||
103 | * @throws \Zend\Validator\Exception\RuntimeException |
||
104 | */ |
||
105 | private function getSchema() |
||
129 | |||
130 | /** |
||
131 | * @param mixed $value |
||
132 | * @return \stdClass |
||
133 | * @throws \Zend\Json\Exception\RuntimeException |
||
134 | */ |
||
135 | private function decodeValue($value) |
||
144 | |||
145 | /** |
||
146 | * @return string[] |
||
147 | */ |
||
148 | public function getMessages() |
||
152 | |||
153 | /** |
||
154 | * @return string |
||
155 | */ |
||
156 | public function getFile() |
||
160 | |||
161 | /** |
||
162 | * @param string $file |
||
163 | */ |
||
164 | public function setFile($file) |
||
168 | |||
169 | /** |
||
170 | * @return string[] |
||
171 | */ |
||
172 | public function getErrorKeys() |
||
176 | |||
177 | /** |
||
178 | * @param string[] $errorKeys |
||
179 | */ |
||
180 | public function setErrorKeys(array $errorKeys) |
||
184 | |||
185 | /** |
||
186 | * @return string |
||
187 | */ |
||
188 | public function getMessagePrefix() |
||
192 | |||
193 | /** |
||
194 | * @param string $messagePrefix |
||
195 | */ |
||
196 | public function setMessagePrefix($messagePrefix) |
||
200 | |||
201 | /** |
||
202 | * @return string |
||
203 | */ |
||
204 | public function getMessageSuffix() |
||
208 | |||
209 | /** |
||
210 | * @param string $messageSuffix |
||
211 | */ |
||
212 | public function setMessageSuffix($messageSuffix) |
||
216 | |||
217 | /** |
||
218 | * @return string |
||
219 | */ |
||
220 | public function getMessageAttributeDelimiter() |
||
224 | |||
225 | /** |
||
226 | * @param string $messageAttributeDelimiter |
||
227 | */ |
||
228 | public function setMessageAttributeDelimiter($messageAttributeDelimiter) |
||
232 | } |
||
233 |