1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 09:02:59 +00:00

For dev extraction skip pool building, we already have a working package set

Also reduce getProviders back to just providers, and add some todos
This commit is contained in:
Nils Adermann 2020-03-12 12:19:46 +01:00
parent 06f460c557
commit 281d8930ff
4 changed files with 17 additions and 7 deletions

View file

@ -163,7 +163,7 @@ class RepositorySet
return $candidates;
}
public function getProvidersAndReplacers($packageName)
public function getProviders($packageName)
{
$providers = array();
foreach ($this->repositories as $repository) {
@ -173,7 +173,7 @@ class RepositorySet
}
} else {
foreach ($repository->getPackages() as $candidate) {
foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
foreach ($candidate->getProvides() as $link) {
if ($packageName === $link->getTarget()) {
$providers[] = array(
'name' => $candidate->getName(),
@ -200,10 +200,8 @@ class RepositorySet
*
* @return Pool
*/
public function createPool(Request $request, EventDispatcher $eventDispatcher = null)
public function createPool(Request $request, EventDispatcher $eventDispatcher = null, $allPackages = false)
{
$poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $eventDispatcher);
foreach ($this->repositories as $repo) {
if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
throw new \LogicException('The pool can not accept packages from an installed repository');
@ -212,6 +210,16 @@ class RepositorySet
$this->locked = true;
if ($allPackages) {
$packages = array();
foreach ($this->repositories as $repository) {
$packages = array_merge($packages, $repository->getPackages());
}
return new Pool($packages);
}
$poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $eventDispatcher);
return $poolBuilder->buildPool($this->repositories, $request);
}