Library/BranchGraph.php
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;
            }
        }
    }
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;
            }
        }
    }
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 ; } } }
Adds a leaf to the branch tree.

@param Branch $branch
Adds a leaf to the branch tree .