| Conditions | 5 |
| Paths | 5 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 16 | public function read(?SchemaProviderInterface $nextProvider = null): ?array |
|
| 20 | { |
||
| 21 | 16 | if ($this->providers === null) { |
|
| 22 | 1 | throw new SchemaProviderException(self::class . ' is not configured.'); |
|
| 23 | } |
||
| 24 | 15 | $parts = []; |
|
| 25 | 15 | foreach ($this->providers as $provider) { |
|
| 26 | 12 | $parts[] = $provider->read(); |
|
| 27 | } |
||
| 28 | |||
| 29 | 13 | $schema = (new SchemaMerger())->merge(...$parts); |
|
| 30 | |||
| 31 | 12 | if ($schema !== null || $nextProvider === null) { |
|
| 32 | 10 | return $schema; |
|
| 33 | } |
||
| 34 | 3 | return $nextProvider->read(); |
|
| 35 | } |
||
| 37 |