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