Exemplo n.º 1
0
 protected function renderChildren(NodeInterface $node)
 {
     $return = null;
     foreach ($node->getChildren() as $child) {
         $return .= $child->render();
     }
     return $return;
 }
Exemplo n.º 2
0
 public function visit(NodeInterface $node)
 {
     $nodes = [$node];
     foreach ($node->getChildren() as $child) {
         $nodes = array_merge($nodes, $child->accept($this));
     }
     return $nodes;
 }
Exemplo n.º 3
0
 /**
  * {@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;
 }
Exemplo n.º 4
0
 /**
  * @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;
 }