Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/CircularLinkedList.php 1 location

@@ 165-183 (lines=19) @@
162
    /**
163
     * {@inheritDoc}
164
     */
165
    public function indexOf($data) {
166
        if($this->head === null) {
167
            return false;
168
        }
169
        
170
        $current = $this->head;
171
        $i = 0;
172
        
173
        while($i < $this->size) {
174
            if($current->data === $data) {
175
                return $i;
176
            }
177
178
            $current = $current->next;
179
            $i++;
180
        }
181
182
        return false;
183
    }
184
185
    /**
186
     * {@inheritDoc}

DataStructures/Lists/DoublyLinkedList.php 1 location

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

DataStructures/Lists/SimpleLinkedList.php 1 location

@@ 111-129 (lines=19) @@
108
    /**
109
     * {@inheritDoc}
110
     */
111
    public function indexOf($data) {
112
        if($this->head === null) {
113
            return false;
114
        }
115
        
116
        $current = $this->head;
117
        $i = 0;
118
        
119
        while($i < $this->size) {
120
            if($current->data === $data) {
121
                return $i;
122
            }
123
124
            $current = $current->next;
125
            $i++;
126
        }
127
128
        return false;
129
    }
130
131
    /**
132
     * {@inheritDoc}