| Conditions | 3 |
| Paths | 3 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 1 | public function __construct($items) |
|
| 18 | { |
||
| 19 | 1 | if (null === $items) { |
|
| 20 | 1 | parent::__construct(static::NAME, null); |
|
| 21 | |||
| 22 | 1 | return; |
|
| 23 | } |
||
| 24 | |||
| 25 | 1 | if (\is_array($items)) { |
|
| 26 | 1 | Assert::isList($items); |
|
| 27 | 1 | Assert::allIsInstanceOf($items, SchemaInterface::class); |
|
| 28 | |||
| 29 | 1 | parent::__construct(static::NAME, array_map( |
|
| 30 | 1 | function (SchemaInterface $schemaMetadata) { |
|
| 31 | 1 | return $schemaMetadata->toJsonSchema(); |
|
| 32 | 1 | }, |
|
| 33 | $items |
||
| 34 | )); |
||
| 35 | |||
| 36 | 1 | return; |
|
| 37 | } |
||
| 38 | |||
| 39 | 1 | Assert::isInstanceOf($items, SchemaInterface::class); |
|
| 40 | |||
| 41 | 1 | parent::__construct(static::NAME, $items->toJsonSchema()); |
|
| 42 | 1 | } |
|
| 44 |