Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/CircularLinkedList.php 1 location

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

DataStructures/Lists/DoublyLinkedList.php 1 location

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

DataStructures/Lists/SimpleLinkedList.php 1 location

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