Code Duplication    Length = 4-5 lines in 3 locations

DataStructures/Lists/SimpleLinkedList.php 3 locations

@@ 91-94 (lines=4) @@
88
89
        $current = $this->head;
90
        $i = 0;
91
        while($i < $index && $current->next !== null) {
92
            $current = $current->next;
93
            $i++;
94
        }
95
96
        return $current;
97
    }
@@ 235-239 (lines=5) @@
232
            $i = 0;
233
            $current = $this->head;
234
            $prev = $current;
235
            while($i < $index && $current->next !== null) {
236
                $prev = $current;
237
                $current = $current->next;
238
                $i++;
239
            }
240
241
            $prev->next = &$newNode;
242
            $newNode->next = &$current;
@@ 278-281 (lines=4) @@
275
        $i = 0;
276
        $current = $this->head;
277
        $prev = $current;
278
        while($i < $index && $current->next !== null) {
279
            $prev = $current;
280
            $current = $current->next;
281
        }
282
283
        if($index === $this->size - 1) {
284
            $prev->next = null;