/** * Add a child node to the current node. * * Notifies the child of its parent and adds the child name to * the child name array. Does not enforce unique names since it * may be desireable to have non-unique named children. It's on * the developer to not rely on the get() method in that case * * @return void */ public function add(EE_TreeNode $child) { if ($child == $this) { throw new RuntimeException('Cannot add tree node to itself.'); } if ($this->_frozen) { throw new RuntimeException('Cannot add child. Tree node is frozen.'); } $this->children[] = $child; $this->children_names[$child->name] = $child; $child->_set_parent($this); }