Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function validate(Json $json, Validator $validator) |
||
23 | { |
||
24 | $refResolver = new RefResolver(new UriRetriever, new UriResolver); |
||
25 | $schema = $refResolver->resolve('file://' . realpath($this->filename)); |
||
26 | |||
27 | $validator->check($json->getRawContent(), $schema); |
||
28 | |||
29 | if (!$validator->isValid()) { |
||
30 | $msg = "JSON does not validate. Violations:" . PHP_EOL; |
||
31 | foreach ($validator->getErrors() as $error) { |
||
32 | $msg .= sprintf(" - [%s] %s" . PHP_EOL, $error['property'], $error['message']); |
||
40 |