1
0
Fork 0

Refactored the search of suggested packages to support replacements

Fixes #752
pull/1067/head
Christophe Coevoet 2012-09-05 21:00:24 +02:00
parent f181dc84e2
commit d0faa016c1
1 changed files with 10 additions and 1 deletions

View File

@ -188,7 +188,16 @@ class Installer
// output suggestions
foreach ($this->suggestedPackages as $suggestion) {
if (!$installedRepo->findPackages($suggestion['target'])) {
$target = $suggestion['target'];
if ($installedRepo->filterPackages(function (PackageInterface $package) use ($target) {
// check the name first as it is the common case
if ($package->getName() === $target) {
return false;
}
if (in_array($target, $package->getNames())) {
return false;
}
})) {
$this->io->write($suggestion['source'].' suggests installing '.$suggestion['target'].' ('.$suggestion['reason'].')');
}
}