| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2.003 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 2 | protected function createSchema(string $id): \stdClass |
|
| 37 | { |
||
| 38 | 2 | $mainSchemaFilePath = $this->fileLocator->locate($this->registeredSchemas[$id]); |
|
| 39 | 2 | $schemaUri = basename($mainSchemaFilePath); |
|
| 40 | 2 | $schemaBaseUri = sprintf('file://%s/%s', \dirname($mainSchemaFilePath), $schemaUri); |
|
| 41 | |||
| 42 | 2 | $retriever = new UriRetriever(); |
|
| 43 | 2 | $schema = $retriever->retrieve($schemaUri, $schemaBaseUri); |
|
| 44 | |||
| 45 | 2 | $schemaStorage = new SchemaStorage($retriever); |
|
| 46 | 2 | $schemaStorage->addSchema($schemaBaseUri, $schema); |
|
| 47 | |||
| 48 | 2 | if (!$schema instanceof \stdClass) { |
|
| 49 | throw new \InvalidArgumentException('Retriever result is not instance of \stdClass'); |
||
| 50 | } |
||
| 51 | |||
| 52 | 2 | return $schema; |
|
| 53 | } |
||
| 54 | } |
||
| 55 |