Code Duplication    Length = 5-7 lines in 2 locations

DataStructures/Trees/AVLTree.php 1 location

@@ 64-70 (lines=7) @@
61
     */
62
    private function leftRotation(AVLNode $node) {
63
        $temp = &$node->right;
64
        if($node->parent !== null) {
65
            if($node->parent->right === $node) {
66
                $node->parent->right = &$node;
67
            } else {
68
                $node->parent->left = &$node;
69
            }
70
        }
71
        $temp->parent = &$node->parent;
72
        $node->parent = &$temp;
73
        $node->right = $temp->left;

DataStructures/Trees/BinaryTreeAbstract.php 1 location

@@ 369-373 (lines=5) @@
366
    protected function replace(&$nodeToReplace, &$newNode) {
367
        if($nodeToReplace->parent === null) {
368
            $this->root = &$newNode;
369
        } else if($nodeToReplace === $nodeToReplace->parent->left) {
370
            $nodeToReplace->parent->left = &$newNode;
371
        } else if($nodeToReplace === $nodeToReplace->parent->right) {
372
            $nodeToReplace->parent->right = &$newNode;
373
        }
374
375
        if($newNode !== null) {
376
            $newNode->parent = &$nodeToReplace->parent;