Code Duplication    Length = 18-19 lines in 2 locations

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 284-301 (lines=18) @@
281
     * @param integer $index the position.
282
     * @return mixed the data stored in the node.
283
     */
284
    private function deleteAt($index) {
285
        $i = 0;
286
        $prev = $this->head;
287
        $current = $this->head;
288
        
289
        while($i < $index) {
290
            $prev = $current;
291
            $current = $current->next;
292
            $i++;
293
        }
294
295
        $temp = $current;
296
        $prev->next = &$current->next;
297
        $current = null;
298
        $this->size--;
299
300
        return $temp->data;
301
    }
302
303
    /**
304
     * Deletes at the end of the list and returns the data stored.

DataStructures/Lists/DoublyLinkedList.php 1 location

@@ 308-326 (lines=19) @@
305
     * @param integer $index the position.
306
     * @return mixed the data stored in the node.
307
     */
308
    private function deleteAt($index) {
309
        $i = 0;
310
        $prev = $this->head;
311
        $current = $this->head;
312
        
313
        while($i < $index) {
314
            $prev = $current;
315
            $current = $current->next;
316
            $i++;
317
        }
318
319
        $temp = $current;
320
        $prev->next = &$current->next;
321
        $current->next->prev = &$pre;
322
        $current = null;
323
        $this->size--;
324
325
        return $temp->data;
326
    }
327
328
    /**
329
     * Deletes at the end of the list and returns the data stored.