| Conditions | 5 |
| Paths | 7 |
| Total Lines | 28 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 1 | public function __construct(?array $properties) |
|
| 18 | { |
||
| 19 | 1 | if (null === $properties) { |
|
|
|
|||
| 20 | 1 | parent::__construct(static::NAME, null); |
|
| 21 | |||
| 22 | 1 | return; |
|
| 23 | } |
||
| 24 | |||
| 25 | 1 | Assert::isNonEmptyList($properties); |
|
| 26 | 1 | Assert::allIsInstanceOf($properties, PropertyInterface::class); |
|
| 27 | |||
| 28 | 1 | $dependentRequired = []; |
|
| 29 | |||
| 30 | 1 | foreach ($properties as $property) { |
|
| 31 | 1 | $propertyDependentRequired = $property->getDependentRequired(); |
|
| 32 | |||
| 33 | 1 | if (null !== $propertyDependentRequired) { |
|
| 34 | 1 | $dependentRequired[$property->getName()] = $propertyDependentRequired; |
|
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | 1 | if (0 === \count($dependentRequired)) { |
|
| 39 | 1 | parent::__construct(static::NAME, null); |
|
| 40 | |||
| 41 | 1 | return; |
|
| 42 | } |
||
| 43 | |||
| 44 | 1 | parent::__construct(static::NAME, (object) $dependentRequired); |
|
| 45 | 1 | } |
|
| 47 |