1 | <?php |
||
18 | class Validator implements ValidatorInterface |
||
19 | { |
||
20 | /** |
||
21 | * @var \stdClass JSON schema |
||
22 | */ |
||
23 | private $schema; |
||
24 | /** |
||
25 | * @var ValidatorServiceInterface Validator |
||
26 | */ |
||
27 | private $validator; |
||
28 | |||
29 | /** |
||
30 | * Constructor |
||
31 | * |
||
32 | * @param ValidatorServiceInterface $validator Validator |
||
33 | * @param \stdClass $schema JSON schema |
||
34 | */ |
||
35 | 4 | public function __construct(ValidatorServiceInterface $validator, \stdClass $schema) |
|
36 | { |
||
37 | 4 | $this->validator = $validator; |
|
38 | 4 | $this->schema = $schema; |
|
39 | 4 | } |
|
40 | |||
41 | /** |
||
42 | * Validate raw JSON definition |
||
43 | * |
||
44 | * @param string $json JSON definition |
||
45 | * @return Error[] |
||
46 | * @throws InvalidJsonException If JSON is not valid |
||
47 | */ |
||
48 | 4 | public function validateJsonDefinition($json) |
|
64 | |||
65 | /** |
||
66 | * Get JSON decode last error message |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 1 | private function getJsonLastErrorMessage() |
|
86 | } |
||
87 |