Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 93.75% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
12 | class JsonSchemaValidatorFactory extends AbstractSchemaValidatorFactory implements SchemaValidatorFactoryInterface |
||
13 | { |
||
14 | /** |
||
15 | * {@inheritdoc} |
||
16 | */ |
||
17 | 6 | public function getValidator(string $id): SchemaValidatorInterface |
|
18 | { |
||
19 | 6 | $this->assertHasSchema($id); |
|
20 | |||
21 | 5 | if (!$this->registeredSchemas[$id] instanceof JsonSchemaValidator) { |
|
22 | 5 | $this->registeredSchemas[$id] = new JsonSchemaValidator($this->createSchema($id), new Validator()); |
|
23 | } |
||
24 | |||
25 | 5 | return $this->registeredSchemas[$id]; |
|
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param string $id |
||
30 | * |
||
31 | * @throws \InvalidArgumentException |
||
32 | * @throws FileLocatorFileNotFoundException |
||
33 | * |
||
34 | * @return \stdClass |
||
35 | */ |
||
36 | 5 | protected function createSchema(string $id): \stdClass |
|
53 | } |
||
54 | } |
||
55 |