Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/SimpleLinkedList.php 1 location

@@ 116-134 (lines=19) @@
113
    /**
114
     * {@inheritDoc}
115
     */
116
    public function indexOf($data) {
117
        if($this->head === null) {
118
            return false;
119
        }
120
        
121
        $current = $this->head;
122
        $i = 0;
123
        
124
        while($i < $this->size) {
125
            if($current->data === $data) {
126
                return $i;
127
            }
128
129
            $current = $current->next;
130
            $i++;
131
        }
132
133
        return false;
134
    }
135
136
    /**
137
     * {@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

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