1
0
Fork 0

Cache whatProvide calls

pull/1168/head
Jordi Boggiano 2012-10-14 16:34:17 +02:00
parent 07f72e9fb6
commit 21a0ae9cad
1 changed files with 13 additions and 0 deletions

View File

@ -46,6 +46,7 @@ class Pool
protected $acceptableStabilities;
protected $stabilityFlags;
protected $versionParser;
protected $providerCache = array();
protected $id = 1;
public function __construct($minimumStability = 'stable', array $stabilityFlags = array())
@ -215,6 +216,18 @@ class Pool
* @return array A set of packages
*/
public function whatProvides($name, LinkConstraintInterface $constraint = null)
{
if (isset($this->providerCache[$name][(string) $constraint])) {
return $this->providerCache[$name][(string) $constraint];
}
return $this->providerCache[$name][(string) $constraint] = $this->computeWhatProvides($name, $constraint);
}
/**
* @see whatProvides
*/
private function computeWhatProvides($name, $constraint)
{
$candidates = array();