mirror of
https://github.com/composer/composer
synced 2025-05-11 01:22:54 +00:00
Added a method to find packages by name
This commit is contained in:
parent
098ba8e583
commit
fc17e26bc3
2 changed files with 22 additions and 0 deletions
|
@ -41,6 +41,19 @@ class ArrayRepository implements RepositoryInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function findPackagesByName($name)
|
||||
{
|
||||
// normalize name
|
||||
$name = strtolower($name);
|
||||
|
||||
return array_filter($this->getPackages(), function(PackageInterface $package) use ($name) {
|
||||
return $package->getName() === $name;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue