Code Duplication    Length = 17-18 lines in 2 locations

src/Api/Puli.php 2 locations

@@ 644-660 (lines=17) @@
641
     *
642
     * @return RepositoryManager The repository manager.
643
     */
644
    public function getRepositoryManager()
645
    {
646
        if (!$this->started) {
647
            throw new LogicException('Puli was not started');
648
        }
649
650
        if (!$this->repositoryManager && $this->context instanceof ProjectContext) {
651
            $this->repositoryManager = new RepositoryManagerImpl(
652
                $this->context,
653
                $this->getRepository(),
654
                $this->getPackageManager()->findPackages(Expr::method('isEnabled', Expr::same(true))),
655
                $this->getPackageFileStorage()
656
            );
657
        }
658
659
        return $this->repositoryManager;
660
    }
661
662
    /**
663
     * Returns the resource discovery manager.
@@ 667-684 (lines=18) @@
664
     *
665
     * @return DiscoveryManager The discovery manager.
666
     */
667
    public function getDiscoveryManager()
668
    {
669
        if (!$this->started) {
670
            throw new LogicException('Puli was not started');
671
        }
672
673
        if (!$this->discoveryManager && $this->context instanceof ProjectContext) {
674
            $this->discoveryManager = new DiscoveryManagerImpl(
675
                $this->context,
676
                $this->getDiscovery(),
677
                $this->getPackageManager()->findPackages(Expr::method('isEnabled', Expr::same(true))),
678
                $this->getPackageFileStorage(),
679
                $this->logger
680
            );
681
        }
682
683
        return $this->discoveryManager;
684
    }
685
686
    /**
687
     * Returns the asset manager.