Example #1
0
 /**
  * Copies this node to a new parent. This copies the node
  * to the new parent node/tree and all its child nodes (ie
  * a deep copy). Technically, new nodes are created with copies
  * of the tag data, since this is for all intents and purposes
  * the only thing that needs copying.
  *
  * @param  object $newParent The new parent Tree_Node or Tree object
  * @return object            The new node
  */
 public function copyTo($newParent)
 {
     $newNode = $newParent->nodes->add(new Tree_Node($this->getTag()));
     // Copy child nodes
     $this->nodes->copyTo($newNode);
     return $newNode;
 }