Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/SimpleLinkedList.php 1 location

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

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