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

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

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