Code Duplication    Length = 19-19 lines in 3 locations

DataStructures/Lists/CircularLinkedList.php 1 location

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

DataStructures/Lists/DoublyLinkedList.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/SinglyLinkedList.php 1 location

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