Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/DoublyLinkedList.php 1 location

@@ 154-172 (lines=19) @@
151
    /**
152
     * {@inheritDoc}
153
     */
154
    public function indexOf($data) {
155
        if($this->head === null) {
156
            return false;
157
        }
158
        
159
        $current = $this->head;
160
        $i = 0;
161
        
162
        while($i < $this->size) {
163
            if($current->data === $data) {
164
                return $i;
165
            }
166
167
            $current = $current->next;
168
            $i++;
169
        }
170
171
        return false;
172
    }
173
174
    /**
175
     * {@inheritDoc}

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 235-253 (lines=19) @@
232
    /**
233
     * {@inheritDoc}
234
     */
235
    public function indexOf($data) {
236
        if($this->head === null) {
237
            return false;
238
        }
239
        
240
        $current = $this->head;
241
        $i = 0;
242
        
243
        while($i < $this->size) {
244
            if($current->data === $data) {
245
                return $i;
246
            }
247
248
            $current = $current->next;
249
            $i++;
250
        }
251
252
        return false;
253
    }
254
255
    /**
256
     * {@inheritDoc}

DataStructures/Lists/SimpleLinkedList.php 1 location

@@ 140-158 (lines=19) @@
137
    /**
138
     * {@inheritDoc}
139
     */
140
    public function indexOf($data) {
141
        if($this->head === null) {
142
            return false;
143
        }
144
        
145
        $current = $this->head;
146
        $i = 0;
147
        
148
        while($i < $this->size) {
149
            if($current->data === $data) {
150
                return $i;
151
            }
152
153
            $current = $current->next;
154
            $i++;
155
        }
156
157
        return false;
158
    }
159
160
    /**
161
     * {@inheritDoc}