Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function validate(Json $json, Validator $validator) |
||
31 | { |
||
32 | $validator->check($json->getContent(), $this->getContent()); |
||
33 | |||
34 | if (!$validator->isValid()) { |
||
35 | $msg = "JSON does not validate. Violations:".PHP_EOL; |
||
36 | foreach ($validator->getErrors() as $error) { |
||
37 | $msg .= sprintf(" - [%s] %s".PHP_EOL, $error['property'], $error['message']); |
||
38 | } |
||
39 | throw new \Exception($msg); |
||
40 | } |
||
41 | |||
42 | return true; |
||
43 | } |
||
44 | |||
50 |