Code Duplication    Length = 19-19 lines in 3 locations

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

@@ 216-234 (lines=19) @@
213
    /**
214
     * {@inheritDoc}
215
     */
216
    public function lastIndexOf($data) {
217
        if($this->head === null) {
218
            return false;
219
        }
220
        
221
        $current = $this->head;
222
        $i = 0;
223
        $pos = false;
224
        while($i < $this->size) {
225
            if($current->data === $data) {
226
                $pos = $i;
227
            }
228
229
            $current = $current->next;
230
            $i++;
231
        }
232
        
233
        return $pos;
234
    }
235
236
    /**
237
     * {@inheritDoc}

DataStructures/Lists/DoublyLinkedList.php 1 location

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