Exemple #1
0
 /**
  * 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);
     }
 }
Exemple #2
0
 function findParent(Node $node, $type = null)
 {
     if ($node->getType() == $type) {
         return $node;
     } else {
         findParent($node->getParent(), $type);
     }
 }
Exemple #3
0
 /**
  * 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);
 }
Exemple #4
0
 /**
  * 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();
 }