/** * Attach a child node * * @param \Zend\Server\Reflection\Node $node * @return void */ public function attachChild(Node $node) { $this->children[] = $node; if ($node->getParent() !== $this) { $node->setParent($this); } }
function findParent(Node $node, $type = null) { if ($node->getType() == $type) { return $node; } else { findParent($node->getParent(), $type); } }
/** * Copy the current node to a new location, as a sibling of given node. * @param vakata\phptree\Node $reference the reference node * @return vakata\phptree\Node the newly create node */ public function copyBefore(Node $reference) { $id = $this->tree->copy($this->id, $reference->getParent()->getID(), $reference->getIndex()); return $this->tree->node($id); }
/** * Test if the node is a sibling of a given node. * @param Node $inNode Node to compare with. * @return bool If the node is a sibling of the given node, then the method returns the value `true`. * Otherwise, it returns the value `false`. */ public function isSiblingWith(Node $inNode) { return $this->getParent() === $inNode->getParent(); }