Code Duplication    Length = 19-19 lines in 3 locations

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/CircularLinkedList.php 1 location

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

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}