Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/DoublyLinkedList.php 1 location

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

DataStructures/Lists/SimpleLinkedList.php 1 location

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

DataStructures/Lists/CircularLinkedList.php 1 location

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