Code Duplication    Length = 9-9 lines in 2 locations

DataStructures/Lists/Queue.php 1 location

@@ 71-79 (lines=9) @@
68
        }
69
        
70
        $newNode = new Node($data);
71
        if($this->head === null) {
72
            $this->head = &$newNode;
73
            $this->tail = &$this->head;
74
            $newNode->next = &$this->tail;
75
        } else {
76
            $this->tail->next = &$newNode;
77
            $newNode->next = &$this->head;
78
            $this->tail = &$newNode;
79
        }
80
        $this->size++;
81
    }
82
    

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 69-77 (lines=9) @@
66
     */
67
    private function insertBeginning($data) {
68
        $newNode = new Node($data);
69
        if($this->head === null) {
70
            $newNode->next = &$this->head;
71
            $this->head = &$newNode;
72
            $this->tail = &$newNode;
73
        } else {
74
            $this->tail->next = &$newNode;
75
            $newNode->next = &$this->head;
76
            $this->head = &$newNode;
77
        }
78
    }
79
80
    /**