Code Duplication    Length = 9-9 lines in 2 locations

DataStructures/Trees/BinarySearchTree.php 2 locations

@@ 106-114 (lines=9) @@
103
            return null;
104
        }
105
106
        while($node !== null) {
107
            if($key < $node->key) {
108
                $node = $node->left;
109
            } else if($key > $node->key) {
110
                $node = $node->right;
111
            } else {
112
                return $node->data;
113
            }
114
        }
115
116
        if($node === null) {
117
            return null;
@@ 379-387 (lines=9) @@
376
            return $this->root;
377
        } else {
378
            $node = $this->root;
379
            while($node !== null) {
380
                if($key < $node->key) {
381
                    $node = $node->left;
382
                } else if($key > $node->key) {
383
                    $node = $node->right;
384
                } else {
385
                    return $node;
386
                }
387
            }
388
        }
389
390
        return null;