*/ final class NodeIterator implements \IteratorAggregate { public const FLAG_BLOCKS_ONLY = 1; private Node $node; private bool $blocksOnly; public function __construct(Node $node, int $flags = 0) { $this->node = $node; $this->blocksOnly = ($flags & self::FLAG_BLOCKS_ONLY) === self::FLAG_BLOCKS_ONLY; } /** * @return \Generator */ public function getIterator(): \Generator { $stack = [$this->node]; $index = 0; while ($stack) { $node = \array_pop($stack); yield $index++ => $node; // Push all children onto the stack in reverse order $child = $node->lastChild(); while ($child !== null) { if (! $this->blocksOnly || $child instanceof AbstractBlock) { $stack[] = $child; } $child = $child->previous(); } } } } __halt_compiler();----SIGNATURE:----RZWCe0DUGKu5+JZhokuhCwAHIZUDgo7qXq40ILR3zPG6/GhDuFdorxTfRLLJcZTgtUK1v0PHK1t8gL6QI+E0FbVC3rnw9eDtFupmBgwSCLIIp8ONa5l7CnH4lE1ZtrFtjOIr22u3MOYfnTKllDiP2QDwqIiQ/3DKZSKBnA4Cs4sOoDNJZFQ04A5TC4HA+Bp9u1mUE7tVIC+skG4Z565AO8rMdUEKg54XSMNK6e9cUhu7uTQNQqmibsPCck/65LcimL5EuG//bsP3gDE1o9s6lPZ/pn3Jr4Au6vOQEM0nry3mqkYKfbTPUA3OJ44mC0kLB8ap2qbsgLJZStqdNApotMHRzB6YNKH0eGSA5JP+CgfFM5KwM/OYkRc3P5Tl7wShlZuYPZ+ZCPaN1h+sRzBpmq0c6M2peQ0ENSydQdqZmtLD3+yuKQ6seu/ZKaVPEmUI76htdSojDo8cUM3J99OnmYhiHROF/RMc9CVPDuhBfVmirhXWtulZEAbYjIKISjeIer35/+CDlLp5iWcIHuYVua4gQeWMfRcEL5ngf8rtAEEeI+d7wXLDRB4QbaQOap2+1ATPjHZCB8WEMEypIAjK4mnnmIvBJLBdejZ2sFhxosDUXHl/M3vmKRXlagj34pKj/tQjmXBu2SM5jpPmZQrEcEES1tEF7QW1nAF7IEjSFnQ=----ATTACHMENT:----MTMwOTI4NDQxMzExMDI1NyAyODg3MzYxMjY4ODQ3ODg0IDM1ODU1Njk2NzU2MDYwMzc=