mirror of
https://github.com/composer/composer
synced 2025-05-10 09:02:59 +00:00
Implement getProviders on reposet for all repo types and add replacers
This way errors during require dev extraction make more sense
This commit is contained in:
parent
ddb1e79bef
commit
1f467046d7
5 changed files with 64 additions and 9 deletions
|
@ -163,17 +163,31 @@ class RepositorySet
|
|||
return $candidates;
|
||||
}
|
||||
|
||||
public function getProviders($packageName)
|
||||
public function getProvidersAndReplacers($packageName)
|
||||
{
|
||||
$providers = array();
|
||||
foreach ($this->repositories as $repository) {
|
||||
if ($repository instanceof ComposerRepository) {
|
||||
if ($providers = $repository->getProviders($packageName)) {
|
||||
return $providers;
|
||||
if ($repoProviders = $repository->getProviders($packageName)) {
|
||||
$providers = array_merge($providers, $repoProviders);
|
||||
}
|
||||
} else {
|
||||
foreach ($repository->getPackages() as $candidate) {
|
||||
foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
|
||||
if ($packageName === $link->getTarget()) {
|
||||
$providers[] = array(
|
||||
'name' => $candidate->getName(),
|
||||
'description' => $candidate->getDescription(),
|
||||
'type' => $candidate->getType(),
|
||||
);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
return $providers;
|
||||
}
|
||||
|
||||
public function isPackageAcceptable($names, $stability)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue