Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 257-275 (lines=19) @@
254
    /**
255
     * {@inheritDoc}
256
     */
257
    public function lastIndexOf($data) {
258
        if($this->head === null) {
259
            return false;
260
        }
261
        
262
        $current = $this->head;
263
        $i = 0;
264
        $pos = false;
265
        while($i < $this->size) {
266
            if($current->data === $data) {
267
                $pos = $i;
268
            }
269
270
            $current = $current->next;
271
            $i++;
272
        }
273
        
274
        return $pos;
275
    }
276
277
    /**
278
     * {@inheritDoc}

DataStructures/Lists/DoublyLinkedList.php 1 location

@@ 176-194 (lines=19) @@
173
    /**
174
     * {@inheritDoc}
175
     */
176
    public function lastIndexOf($data) {
177
        if($this->head === null) {
178
            return false;
179
        }
180
        
181
        $current = $this->head;
182
        $i = 0;
183
        $pos = false;
184
        while($i < $this->size) {
185
            if($current->data == $data) {
186
                $pos = $i;
187
            }
188
189
            $current = $current->next;
190
            $i++;
191
        }
192
193
        return $pos;
194
    }
195
196
    /**
197
     * {@inheritDoc}

DataStructures/Lists/SimpleLinkedList.php 1 location

@@ 161-179 (lines=19) @@
158
    /**
159
     * {@inheritDoc}
160
     */
161
    public function lastIndexOf($data) {
162
        if($this->head === null) {
163
            return false;
164
        }
165
        
166
        $current = $this->head;
167
        $i = 0;
168
        $pos = false;
169
        while($i < $this->size) {
170
            if($current->data == $data) {
171
                $pos = $i;
172
            }
173
174
            $current = $current->next;
175
            $i++;
176
        }
177
178
        return $pos;
179
    }
180
181
    /**
182
     * {@inheritDoc}