1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-11 01:22:54 +00:00

Fixed the tests

array_filter preserves the keys even when filtering an array indexed
numerically.
This commit is contained in:
Christophe Coevoet 2012-01-16 22:40:14 +01:00
parent 38a5f04ea0
commit bca786d5c3

View file

@ -48,10 +48,15 @@ class ArrayRepository implements RepositoryInterface
{
// normalize name
$name = strtolower($name);
$packages = array();
return array_filter($this->getPackages(), function (PackageInterface $package) use ($name) {
return $package->getName() === $name;
});
foreach ($this->getPackages() as $package) {
if ($package->getName() === $name) {
$packages[] = $package;
}
}
return $packages;
}
/**