/** * Constructor. * * @param RMenuNode $root The root node. */ public function __construct(RMenuNode $root) { $this->rootNode = $root; $this->name = $root->getName(); }
/** * Add a child to this node. * * @param RMenuNode $child The child. * * @return RMenuNode This method is chainable. */ public function addChild(RMenuNode $child) { // Add the children. $this->children[$child->getName()] = $child; // Set this node as parent. $child->setParent($this); return $this; }