Code Duplication    Length = 18-18 lines in 2 locations

src/Discovery/DiscoveryManagerImpl.php 1 location

@@ 430-447 (lines=18) @@
427
    /**
428
     * {@inheritdoc}
429
     */
430
    public function hasTypeDescriptors(Expression $expr = null)
431
    {
432
        $this->assertPackagesLoaded();
433
434
        if (!$expr) {
435
            return !$this->typeDescriptors->isEmpty();
436
        }
437
438
        foreach ($this->typeDescriptors->toArray() as $typeName => $descriptorsByPackage) {
439
            foreach ($descriptorsByPackage as $typeDescriptor) {
440
                if ($expr->evaluate($typeDescriptor)) {
441
                    return true;
442
                }
443
            }
444
        }
445
446
        return false;
447
    }
448
449
    /**
450
     * {@inheritdoc}

src/Repository/RepositoryManagerImpl.php 1 location

@@ 412-429 (lines=18) @@
409
    /**
410
     * {@inheritdoc}
411
     */
412
    public function hasPathMappings(Expression $expr = null)
413
    {
414
        $this->assertMappingsLoaded();
415
416
        if (!$expr) {
417
            return !$this->mappings->isEmpty();
418
        }
419
420
        foreach ($this->mappings->toArray() as $mappingsByPackage) {
421
            foreach ($mappingsByPackage as $mapping) {
422
                if ($expr->evaluate($mapping)) {
423
                    return true;
424
                }
425
            }
426
        }
427
428
        return false;
429
    }
430
431
    /**
432
     * {@inheritdoc}