Added a method to find packages by name
parent
098ba8e583
commit
fc17e26bc3
|
@ -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}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,6 +41,15 @@ interface RepositoryInterface extends \Countable
|
||||||
*/
|
*/
|
||||||
function findPackage($name, $version);
|
function findPackage($name, $version);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches for packages by it's name .
|
||||||
|
*
|
||||||
|
* @param string $name package name
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function findPackagesByName($name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of registered packages.
|
* Returns list of registered packages.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue