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