Code Duplication    Length = 11-12 lines in 2 locations

Entity/Listener/PersistentRelatedEntitiesCollection.php 2 locations

@@ 230-240 (lines=11) @@
227
     * @param Closure $p The predicate.
228
     * @return boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise.
229
     */
230
    public function exists(Closure $p)
231
    {
232
        $this->initialize();
233
234
        foreach ($this->entities as $key => $element) {
235
            if ($p($key, $element)) {
236
                return true;
237
            }
238
        }
239
        return false;
240
    }
241
242
    /**
243
     * Searches for a given element and, if found, returns the corresponding key/index
@@ 398-409 (lines=12) @@
395
     * @param Closure $p The predicate.
396
     * @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
397
     */
398
    public function forAll(Closure $p)
399
    {
400
        $this->initialize();
401
402
        foreach ($this->entities as $key => $element) {
403
            if (!$p($key, $element)) {
404
                return false;
405
            }
406
        }
407
408
        return true;
409
    }
410
411
    /**
412
     * Partitions this collection in two collections according to a predicate.