Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 199-217 (lines=19) @@
196
    /**
197
     * {@inheritDoc}
198
     */
199
    public function lastIndexOf($data) {
200
        if($this->head === null) {
201
            return false;
202
        }
203
        
204
        $current = $this->head;
205
        $i = 0;
206
        $pos = false;
207
        while($i < $this->size) {
208
            if($current->data === $data) {
209
                $pos = $i;
210
            }
211
212
            $current = $current->next;
213
            $i++;
214
        }
215
        
216
        return $pos;
217
    }
218
219
    /**
220
     * {@inheritDoc}

DataStructures/Lists/DoublyLinkedList.php 1 location

@@ 150-168 (lines=19) @@
147
    /**
148
     * {@inheritDoc}
149
     */
150
    public function lastIndexOf($data) {
151
        if($this->head === null) {
152
            return false;
153
        }
154
        
155
        $current = $this->head;
156
        $i = 0;
157
        $pos = false;
158
        while($i < $this->size) {
159
            if($current->data == $data) {
160
                $pos = $i;
161
            }
162
163
            $current = $current->next;
164
            $i++;
165
        }
166
167
        return $pos;
168
    }
169
170
    /**
171
     * {@inheritDoc}

DataStructures/Lists/SimpleLinkedList.php 1 location

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