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

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