Code Duplication    Length = 10-13 lines in 4 locations

core/services/collections/Collection.php 3 locations

@@ 160-171 (lines=12) @@
157
     * @param mixed $identifier
158
     * @return mixed
159
     */
160
    public function get($identifier)
161
    {
162
        $this->rewind();
163
        while ($this->valid()) {
164
            if ($identifier === $this->getInfo()) {
165
                $object = $this->current();
166
                $this->rewind();
167
                return $object;
168
            }
169
            $this->next();
170
        }
171
        return null;
172
    }
173
174
@@ 185-195 (lines=11) @@
182
     * @param  mixed $identifier
183
     * @return bool
184
     */
185
    public function has($identifier)
186
    {
187
        $this->rewind();
188
        while ($this->valid()) {
189
            if ($identifier === $this->getInfo()) {
190
                $this->rewind();
191
                return true;
192
            }
193
            $this->next();
194
        }
195
        return false;
196
    }
197
198
@@ 262-271 (lines=10) @@
259
     * @param mixed $identifier
260
     * @return boolean
261
     */
262
    public function setCurrent($identifier)
263
    {
264
        $this->rewind();
265
        while ($this->valid()) {
266
            if ($identifier === $this->getInfo()) {
267
                return true;
268
            }
269
            $this->next();
270
        }
271
        return false;
272
    }
273
274

core/domain/entities/editor/BlockCollection.php 1 location

@@ 39-51 (lines=13) @@
36
     * @param mixed $identifier
37
     * @return boolean
38
     */
39
    public function unRegisterBlock($identifier)
40
    {
41
        $this->rewind();
42
        while ($this->valid()) {
43
            if ($identifier === $this->getInfo()) {
44
                $object = $this->current();
45
                $this->rewind();
46
                return $object->unRegisterBlock();
47
            }
48
            $this->next();
49
        }
50
        return false;
51
    }
52
53
54
    /**