addChild() public method

Adds a child node to this node and returns the id of the child for this parent.
public addChild ( AbstractNode $child ) : boolean
$child AbstractNode
return boolean
 /**
  * Sets the parent node.
  *
  * @param InnerNode $parent
  * @return $this
  * @throws CircularException
  */
 public function setParent(InnerNode $parent)
 {
     // remove from old parent
     if (!is_null($this->parent)) {
         if ($this->parent->id() == $parent->id()) {
             // already the parent
             return $this;
         }
         $this->parent->removeChild($this->id);
     }
     $this->parent = $parent;
     // assign child to parent
     $this->parent->addChild($this);
     //clear any cache
     $this->clear();
     return $this;
 }