src/ParentNodeTrait.php
public function getChildrenRecursive()
    {
        $res = new ObjectCollection();
        foreach ($this->children() as $child) {
            $res->add($child);
            if ($child instanceof ParentNodeInterface) {
                $res->addMany($child->getChildrenRecursive());
            }
        }

        return $res;
    }
public function getChildrenRecursive()
    {
        $res = new ObjectCollection();
        foreach ($this->children() as $child) {
            $res->add($child);
            if ($child instanceof ParentNodeInterface) {
                $res->addMany($child->getChildrenRecursive());
            }
        }

        return $res;
    }
public function getChildrenRecursive ( ) { $ res = new ObjectCollection ( ) ; foreach ( $ this -> children ( ) as $ child ) { $ res -> add ( $ child ) ; if ( $ child instanceof ParentNodeInterface ) { $ res -> addMany ( $ child -> getChildrenRecursive ( ) ) ; } } return $ res ; }
Returns collection containing all descendant nodes.

@return CollectionInterface|ObjectCollection|ChildNodeInterface[]
Returns collection containing all descendant nodes .