Code Duplication    Length = 4-5 lines in 3 locations

DataStructures/Lists/SimpleLinkedList.php 3 locations

@@ 93-96 (lines=4) @@
90
91
        $current = $this->head;
92
        $i = 0;
93
        while($i < $index && $current->next !== null) {
94
            $current = $current->next;
95
            $i++;
96
        }
97
98
        return $current;
99
    }
@@ 204-208 (lines=5) @@
201
            $i = 0;
202
            $current = $this->head;
203
            $prev = $current;
204
            while($i < $index && $current->next !== null) {
205
                $prev = $current;
206
                $current = $current->next;
207
                $i++;
208
            }
209
210
            $prev->next = &$newNode;
211
            $newNode->next = &$current;
@@ 247-250 (lines=4) @@
244
        $i = 0;
245
        $current = $this->head;
246
        $prev = $current;
247
        while($i < $index && $current->next !== null) {
248
            $prev = $current;
249
            $current = $current->next;
250
        }
251
252
        if($index === $this->size - 1) {
253
            $prev->next = null;