Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 188-206 (lines=19) @@
185
    /**
186
     * {@inheritDoc}
187
     */
188
    public function lastIndexOf($data) {
189
        if($this->head === null) {
190
            return false;
191
        }
192
        
193
        $current = $this->head;
194
        $i = 0;
195
        $pos = false;
196
        while($i < $this->size) {
197
            if($current->data === $data) {
198
                $pos = $i;
199
            }
200
201
            $current = $current->next;
202
            $i++;
203
        }
204
        
205
        return $pos;
206
    }
207
208
    /**
209
     * {@inheritDoc}

DataStructures/Lists/DoublyLinkedList.php 1 location

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

DataStructures/Lists/SimpleLinkedList.php 1 location

@@ 134-152 (lines=19) @@
131
    /**
132
     * {@inheritDoc}
133
     */
134
    public function lastIndexOf($data) {
135
        if($this->head === null) {
136
            return false;
137
        }
138
        
139
        $current = $this->head;
140
        $i = 0;
141
        $pos = false;
142
        while($i < $this->size) {
143
            if($current->data == $data) {
144
                $pos = $i;
145
            }
146
147
            $current = $current->next;
148
            $i++;
149
        }
150
151
        return $pos;
152
    }
153
154
    /**
155
     * {@inheritDoc}