Code Duplication    Length = 10-13 lines in 4 locations

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
    /**

core/services/collections/Collection.php 3 locations

@@ 201-212 (lines=12) @@
198
     * @param mixed $identifier
199
     * @return mixed
200
     */
201
    public function get($identifier)
202
    {
203
        $this->rewind();
204
        while ($this->valid()) {
205
            if ($identifier === $this->getInfo()) {
206
                $object = $this->current();
207
                $this->rewind();
208
                return $object;
209
            }
210
            $this->next();
211
        }
212
        return null;
213
    }
214
215
@@ 225-235 (lines=11) @@
222
     * @param  mixed $identifier
223
     * @return bool
224
     */
225
    public function has($identifier)
226
    {
227
        $this->rewind();
228
        while ($this->valid()) {
229
            if ($identifier === $this->getInfo()) {
230
                $this->rewind();
231
                return true;
232
            }
233
            $this->next();
234
        }
235
        return false;
236
    }
237
238
@@ 297-306 (lines=10) @@
294
     * @param mixed $identifier
295
     * @return boolean
296
     */
297
    public function setCurrent($identifier)
298
    {
299
        $this->rewind();
300
        while ($this->valid()) {
301
            if ($identifier === $this->getInfo()) {
302
                return true;
303
            }
304
            $this->next();
305
        }
306
        return false;
307
    }
308
309