protected function renderChildren(NodeInterface $node) { $return = null; foreach ($node->getChildren() as $child) { $return .= $child->render(); } return $return; }
public function visit(NodeInterface $node) { $nodes = [$node]; foreach ($node->getChildren() as $child) { $nodes = array_merge($nodes, $child->accept($this)); } return $nodes; }
/** * {@inheritdoc} */ public function visit(NodeInterface $node) { if ($node->isLeaf()) { return [$node]; } $yield = []; foreach ($node->getChildren() as $child) { $yield = array_merge($yield, $child->accept($this)); } return $yield; }
/** * @param NodeInterface $node * @return Node|null */ public function visit(NodeInterface $node) { $currAc = $node->getValue(); if ($currAc instanceof Account && $currAc->getId() == $this->valueToFind) { return $node; } foreach ($node->getChildren() as $child) { /** @noinspection PhpVoidFunctionResultUsedInspection */ $found = $child->accept($this); if (!is_null($found)) { return $found; } } return null; }