Code Duplication    Length = 7-8 lines in 3 locations

DataStructures/Trees/BinaryTreeAbstract.php 3 locations

@@ 70-77 (lines=8) @@
67
            $parentNode = &$current;
68
            if($key < $current->key) {
69
                $current = &$current->left;
70
            } else if($key > $current->key) {
71
                $current = &$current->right;
72
            } else {
73
                if($update) {
74
                    $current->data = $data;
75
                }
76
                return;
77
            }
78
        }
79
80
        $newNode->parent = &$parentNode;
@@ 151-157 (lines=7) @@
148
        } else {
149
            $node = $this->root;
150
            while($node !== null) {
151
                if($key < $node->key) {
152
                    $node = $node->left;
153
                } else if($key > $node->key) {
154
                    $node = $node->right;
155
                } else {
156
                    return true;
157
                }
158
            }
159
        }
160
@@ 397-403 (lines=7) @@
394
        } else {
395
            $node = $this->root;
396
            while($node !== null) {
397
                if($key < $node->key) {
398
                    $node = $node->left;
399
                } else if($key > $node->key) {
400
                    $node = $node->right;
401
                } else {
402
                    return $node;
403
                }
404
            }
405
        }
406