Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | public static function fromXML(DOMElement $xml): static |
||
30 | { |
||
31 | Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); |
||
32 | Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); |
||
33 | |||
34 | $a = A::getChildrenOfClass($xml); |
||
35 | Assert::minCount($a, 1, MissingElementException::class); |
||
36 | Assert::maxCount($a, 1, TooManyElementsException::class); |
||
37 | |||
38 | $b = B::getChildrenOfClass($xml); |
||
39 | Assert::minCount($b, 1, MissingElementException::class); |
||
40 | Assert::maxCount($b, 1, TooManyElementsException::class); |
||
41 | |||
42 | return new static( |
||
43 | array_pop($a), |
||
44 | array_pop($b), |
||
45 | ); |
||
48 |