Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/SimpleLinkedList.php 1 location

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

DataStructures/Lists/CircularLinkedList.php 1 location

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

DataStructures/Lists/DoublyLinkedList.php 1 location

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