Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 176-194 (lines=19) @@
173
    /**
174
     * {@inheritDoc}
175
     */
176
    public function indexOf($data) {
177
        if($this->head === null) {
178
            return false;
179
        }
180
        
181
        $current = $this->head;
182
        $i = 0;
183
        
184
        while($i < $this->size) {
185
            if($current->data === $data) {
186
                return $i;
187
            }
188
189
            $current = $current->next;
190
            $i++;
191
        }
192
193
        return false;
194
    }
195
196
    /**
197
     * {@inheritDoc}

DataStructures/Lists/DoublyLinkedList.php 1 location

@@ 127-145 (lines=19) @@
124
    /**
125
     * {@inheritDoc}
126
     */
127
    public function indexOf($data) {
128
        if($this->head === null) {
129
            return false;
130
        }
131
        
132
        $current = $this->head;
133
        $i = 0;
134
        
135
        while($i < $this->size) {
136
            if($current->data === $data) {
137
                return $i;
138
            }
139
140
            $current = $current->next;
141
            $i++;
142
        }
143
144
        return false;
145
    }
146
147
    /**
148
     * {@inheritDoc}

DataStructures/Lists/SimpleLinkedList.php 1 location

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