本文整理汇总了PHP中Branch::getParentBranch方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::getParentBranch方法的具体用法?PHP Branch::getParentBranch怎么用?PHP Branch::getParentBranch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Branch
的用法示例。
在下文中一共展示了Branch::getParentBranch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLeaf
/**
* Adds a leaf to the branch tree
*
* @param Branch $branch
*/
public function addLeaf(Branch $branch)
{
if (isset($this->branchMap[$branch->getUniqueId()])) {
$branchNode = $this->branchMap[$branch->getUniqueId()];
} else {
$branchNode = new BranchGraphNode($branch);
}
$branchNode->increase();
$tempBranch = $branch->getParentBranch();
while ($tempBranch) {
if (isset($this->branchMap[$tempBranch->getUniqueId()])) {
$parentBranchNode = $this->branchMap[$tempBranch->getUniqueId()];
} else {
$parentBranchNode = new BranchGraphNode($tempBranch);
$this->branchMap[$tempBranch->getUniqueId()] = $parentBranchNode;
}
$parentBranchNode->insert($branchNode);
$branchNode = $parentBranchNode;
$tempBranch = $tempBranch->getParentBranch();
if (!$tempBranch) {
$this->root = $parentBranchNode;
}
}
}
示例2: removeBranch
/**
* Removes a branch from the branch manager
*
* @param Branch $branch
*/
public function removeBranch(Branch $branch)
{
$parentBranch = $branch->getParentBranch();
$this->currentBranch = $parentBranch;
$this->level--;
}