Code Duplication    Length = 10-11 lines in 3 locations

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 228-238 (lines=11) @@
225
            return $current->data;
226
        }
227
228
        while($i < $this->size) {
229
            if($prev->data === $data) {
230
                $prev->next = &$current->next;
231
                $this->size--;
232
233
                return $current->data;
234
            }
235
236
            $prev = $current;
237
            $current = $current->next;
238
        }
239
240
        throw new NotFoundException();
241
    }

DataStructures/Lists/DoublyLinkedList.php 1 location

@@ 178-187 (lines=10) @@
175
            return $data;
176
        }
177
178
        while($i < $this->size) {
179
            if($current->data === $data) {
180
                $current->prev = &$current->next;
181
                $current = null;
182
                $this->size--;
183
                return $data;
184
            }
185
186
            $current = $current->next;
187
        }
188
189
        throw new NotFoundException();
190
    }

DataStructures/Lists/SinglyLinkedList.php 1 location

@@ 173-183 (lines=11) @@
170
            return $data;
171
        }
172
        
173
        while($i < $this->size) {
174
            if($current->data === $data) {
175
                $prev->next = &$current->next;
176
                $this->size--;
177
178
                return $data;
179
            }
180
181
            $prev = $current;
182
            $current = $current->next;
183
        }
184
185
        throw new NotFoundException();
186
    }