private function getRequiredPool($packageName, $textConstraint, $onlyLocal)
    {
        if ($onlyLocal === false) {
            return $this->getPool();
        }
        $composer = $this->getComposer();
        $pool = new Pool();

        // Prepare repositories and set up a pool
        $platformOverrides = $composer->getConfig()->get('platform') ?: [];
        /** @var BasePackage $rootPackage */
        $rootPackage = $composer->getPackage();
        if ($rootPackage->getRepository() === null) {
            $packageRepo = new ArrayRepository([$composer->getPackage()]);

            $localRepo = $composer->getRepositoryManager()->getLocalRepository();
            $platformRepo = new PlatformRepository([], $platformOverrides);
            $compositeRepository = new CompositeRepository([$packageRepo, $localRepo, $platformRepo]);

            $pool->addRepository($compositeRepository);

            $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
            $match = $defaultRepos->findPackage($packageName, $textConstraint);
            if ($match) {
                $compositeRepository->addRepository(new ArrayRepository([clone $match]));
            }
        }

        return $pool;
    }
private function getRequiredPool($packageName, $textConstraint, $onlyLocal)
    {
        if ($onlyLocal === false) {
            return $this->getPool();
        }
        $composer = $this->getComposer();
        $pool = new Pool();

        // Prepare repositories and set up a pool
        $platformOverrides = $composer->getConfig()->get('platform') ?: [];
        /** @var BasePackage $rootPackage */
        $rootPackage = $composer->getPackage();
        if ($rootPackage->getRepository() === null) {
            $packageRepo = new ArrayRepository([$composer->getPackage()]);

            $localRepo = $composer->getRepositoryManager()->getLocalRepository();
            $platformRepo = new PlatformRepository([], $platformOverrides);
            $compositeRepository = new CompositeRepository([$packageRepo, $localRepo, $platformRepo]);

            $pool->addRepository($compositeRepository);

            $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
            $match = $defaultRepos->findPackage($packageName, $textConstraint);
            if ($match) {
                $compositeRepository->addRepository(new ArrayRepository([clone $match]));
            }
        }

        return $pool;
    }
private function getRequiredPool ( $ packageName , $ textConstraint , $ onlyLocal ) { if ( $ onlyLocal === false ) { return $ this -> getPool ( ) ; } $ composer = $ this -> getComposer ( ) ; $ pool = new Pool ( ) ; // Prepare repositories and set up a pool $ platformOverrides = $ composer -> getConfig ( ) -> get ( 'platform' ) ? : [ ] ; /** @var BasePackage $rootPackage */ $ rootPackage = $ composer -> getPackage ( ) ; if ( $ rootPackage -> getRepository ( ) === null ) { $ packageRepo = new ArrayRepository ( [ $ composer -> getPackage ( ) ] ) ; $ localRepo = $ composer -> getRepositoryManager ( ) -> getLocalRepository ( ) ; $ platformRepo = new PlatformRepository ( [ ] , $ platformOverrides ) ; $ compositeRepository = new CompositeRepository ( [ $ packageRepo , $ localRepo , $ platformRepo ] ) ; $ pool -> addRepository ( $ compositeRepository ) ; $ defaultRepos = new CompositeRepository ( RepositoryFactory :: defaultRepos ( $ this -> getIO ( ) ) ) ; $ match = $ defaultRepos -> findPackage ( $ packageName , $ textConstraint ) ; if ( $ match ) { $ compositeRepository -> addRepository ( new ArrayRepository ( [ clone $ match ] ) ) ; } } return $ pool ; }
If the version we ask for is not installed then we need to locate it in
remote repos and add it.

This is needed for why-not to resolve conflicts from an uninstalled
version against installed packages.

@param string $packageName    package to inspect
@param string $textConstraint Optional version constraint
@param bool   $onlyLocal

@return Pool
If the version we ask for is not installed then we need to locate it in remote repos and add it .