Conditions | 4 |
Paths | 4 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | public static function fromXML(DOMElement $xml): static |
||
33 | { |
||
34 | Assert::same($xml->localName, static::LOCALNAME, InvalidDOMElementException::class); |
||
35 | Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); |
||
36 | |||
37 | $operation = BindingOperation::getChildrenOfClass($xml); |
||
38 | |||
39 | $children = []; |
||
40 | foreach ($xml->childNodes as $child) { |
||
41 | if (!($child instanceof DOMElement)) { |
||
42 | continue; |
||
43 | } elseif ($child->namespaceURI === static::NS) { |
||
44 | // Only other namespaces are allowed |
||
45 | continue; |
||
46 | } |
||
47 | |||
48 | $children[] = new Chunk($child); |
||
49 | } |
||
50 | |||
51 | return new static( |
||
52 | self::getAttribute($xml, 'name'), |
||
53 | self::getAttribute($xml, 'type'), |
||
54 | $operation, |
||
55 | $children, |
||
56 | ); |
||
59 |