Code Duplication    Length = 18-19 lines in 2 locations

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 369-386 (lines=18) @@
366
     *
367
     * @return mixed the data stored in the node.
368
     */
369
    private function deleteEnd() {
370
        $prev = $this->head;
371
        $current = $this->head;
372
        
373
        while($current !== $this->tail) {
374
            $prev = $current;
375
            $current = $current->next;
376
        }
377
        
378
        $temp = $current;
379
        $prev->next = &$this->head;
380
        $this->tail = &$prev;
381
        $current = null;
382
383
        $this->size--;
384
385
        return $temp->data;
386
    }
387
388
    /**
389
     * Converts/exports the list content into array type.

DataStructures/Lists/DoublyLinkedList.php 1 location

@@ 370-388 (lines=19) @@
367
     *
368
     * @return mixed the data stored in the node.
369
     */
370
    private function deleteEnd() {
371
        $prev = $this->head;
372
        $current = $this->head;
373
        
374
        while($current !== $this->tail) {
375
            $prev = $current;
376
            $current = $current->next;
377
        }
378
        
379
        $temp = $current;
380
        $prev->next = &$this->head;
381
        $this->head->prev = &$prev;
382
        $this->tail = &$prev;
383
        $current = null;
384
385
        $this->size--;
386
387
        return $temp->data;
388
    }
389
    
390
    /**
391
     * Converts/exports the list content into array type.