mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
added findPackage() method to the RepositoryManager and RepositoryInterface
This commit is contained in:
parent
21191ffa00
commit
cc2f2b79ca
3 changed files with 44 additions and 0 deletions
|
@ -22,6 +22,23 @@ class RepositoryManager
|
|||
private $localRepository;
|
||||
private $repositories = array();
|
||||
|
||||
/**
|
||||
* Searches for a package by it's name and version in managed repositories.
|
||||
*
|
||||
* @param string $name package name
|
||||
* @param string $version package version
|
||||
*
|
||||
* @return PackageInterface|null
|
||||
*/
|
||||
public function findPackage($name, $version)
|
||||
{
|
||||
foreach ($this->repositories as $repository) {
|
||||
if ($package = $repository->findPackage($name, $version)) {
|
||||
return $package;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets repository with specific name.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue