Kaynağa Gözat

Rename a few things

Jordi Boggiano 11 yıl önce
ebeveyn
işleme
fc3fbdeab3

+ 11 - 10
src/Composer/Package/LinkConstraint/VersionConstraint.php

@@ -60,19 +60,20 @@ class VersionConstraint extends SpecificConstraint
         return version_compare($a, $b, $operator);
     }
 
+    /**
+     * @param  VersionConstraint $provider
+     * @param  bool              $compareBranches
+     * @return bool
+     */
     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];
+        static $cache = array();
+        if (isset($cache[$this->operator][$this->version][$provider->operator][$provider->version][$compareBranches])) {
+            return $cache[$this->operator][$this->version][$provider->operator][$provider->version][$compareBranches];
         }
 
-        return $c[$this->operator][$this->version][$provider->operator][$provider->version][$compareBranches] =
-            $this->_matchSpecific($provider, $compareBranches);
+        return $cache[$this->operator][$this->version][$provider->operator][$provider->version][$compareBranches] =
+            $this->doMatchSpecific($provider, $compareBranches);
     }
 
     /**
@@ -80,7 +81,7 @@ class VersionConstraint extends SpecificConstraint
      * @param  bool              $compareBranches
      * @return bool
      */
-    public function _matchSpecific(VersionConstraint $provider, $compareBranches = false)
+    private function doMatchSpecific(VersionConstraint $provider, $compareBranches = false)
     {
         $noEqualOp = str_replace('=', '', $this->operator);
         $providerNoEqualOp = str_replace('=', '', $provider->operator);