1
0
Fork 0

Merge remote-tracking branch 'AlexeyKupershtokh/cache-version-constraint'

pull/2453/head
Jordi Boggiano 2013-11-20 14:01:01 +01:00
commit e2f7e4871f
1 changed files with 16 additions and 1 deletions

View File

@ -60,12 +60,27 @@ class VersionConstraint extends SpecificConstraint
return version_compare($a, $b, $operator); return version_compare($a, $b, $operator);
} }
public function matchSpecific(VersionConstraint $provider, $compareBranches = false)
{
static $c = array();
if (isset($c[$this->operator][$this->version][$provider->operator][$provider->version][$compareBranches])) {
//if ($c[$this->operator][$this->version][$provider->operator][$provider->version][$compareBranches] !=
// $this->_matchSpecific($provider, $compareBranches)) {
// throw new \Exception('Broken cache');
//}
return $c[$this->operator][$this->version][$provider->operator][$provider->version][$compareBranches];
}
return $c[$this->operator][$this->version][$provider->operator][$provider->version][$compareBranches] =
$this->_matchSpecific($provider, $compareBranches);
}
/** /**
* @param VersionConstraint $provider * @param VersionConstraint $provider
* @param bool $compareBranches * @param bool $compareBranches
* @return bool * @return bool
*/ */
public function matchSpecific(VersionConstraint $provider, $compareBranches = false) public function _matchSpecific(VersionConstraint $provider, $compareBranches = false)
{ {
$noEqualOp = str_replace('=', '', $this->operator); $noEqualOp = str_replace('=', '', $this->operator);
$providerNoEqualOp = str_replace('=', '', $provider->operator); $providerNoEqualOp = str_replace('=', '', $provider->operator);