/** * Sets the current active branch in the manager * * @param Branch $branch */ public function addBranch(Branch $branch) { if ($this->_currentBranch) { $branch->setParentBranch($this->_currentBranch); $this->_currentBranch = $branch; } else { $this->_currentBranch = $branch; } $branch->setUniqueId($this->_uniqueId); $branch->setLevel($this->_level); $this->_level++; $this->_uniqueId++; }
/** * Sets the current active branch in the manager * * @param Branch $branch */ public function addBranch(Branch $branch) { if ($this->currentBranch) { $branch->setParentBranch($this->currentBranch); $this->currentBranch = $branch; } else { $this->currentBranch = $branch; } $branch->setUniqueId($this->uniqueId); $branch->setLevel($this->level); $this->level++; $this->uniqueId++; if ($branch->getType() == Branch::TYPE_ROOT) { $this->setRootBranch($branch); } }