From 265533d3900da3b93c0ccb77550c07f5e20b31e4 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 21 May 2012 12:39:04 +0200 Subject: [PATCH] Rename watches array to watchChains to make clearer what they are --- .../DependencyResolver/RuleWatchGraph.php | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/Composer/DependencyResolver/RuleWatchGraph.php b/src/Composer/DependencyResolver/RuleWatchGraph.php index e4bd71417..1262722ee 100644 --- a/src/Composer/DependencyResolver/RuleWatchGraph.php +++ b/src/Composer/DependencyResolver/RuleWatchGraph.php @@ -17,7 +17,7 @@ namespace Composer\DependencyResolver; */ class RuleWatchGraph { - protected $watches = array(); + protected $watchChains = array(); /** * Alters watch chains for a rule. @@ -30,28 +30,30 @@ class RuleWatchGraph } foreach (array($node->watch1, $node->watch2) as $literal) { - if (!isset($this->watches[$literal])) { - $this->watches[$literal] = new RuleWatchChain; + if (!isset($this->watchChains[$literal])) { + $this->watchChains[$literal] = new RuleWatchChain; } - $this->watches[$literal]->unshift($node); + $this->watchChains[$literal]->unshift($node); } } public function contains($literal) { - return isset($this->watches[$literal]); + return isset($this->watchChains[$literal]); } public function propagateLiteral($literal, $level, $skipCallback, $conflictCallback, $decideCallback) { - if (!isset($this->watches[$literal])) { + if (!isset($this->watchChains[$literal])) { return null; } - $this->watches[$literal]->rewind(); - while ($this->watches[$literal]->valid()) { - $node = $this->watches[$literal]->current(); + $chain = $this->watchChains[$literal]; + + $chain->rewind(); + while ($chain->valid()) { + $node = $chain->current(); $otherWatch = $node->getOtherWatch($literal); if (!$node->getRule()->isDisabled() && !call_user_func($skipCallback, $otherWatch)) { @@ -76,7 +78,7 @@ class RuleWatchGraph call_user_func($decideCallback, $otherWatch, $level, $node->getRule()); } - $this->watches[$literal]->next(); + $chain->next(); } return null; @@ -84,12 +86,12 @@ class RuleWatchGraph protected function moveWatch($fromLiteral, $toLiteral, $node) { - if (!isset($this->watches[$toLiteral])) { - $this->watches[$toLiteral] = new RuleWatchChain; + if (!isset($this->watchChains[$toLiteral])) { + $this->watchChains[$toLiteral] = new RuleWatchChain; } $node->moveWatch($fromLiteral, $toLiteral); - $this->watches[$fromLiteral]->remove(); - $this->watches[$toLiteral]->unshift($node); + $this->watchChains[$fromLiteral]->remove(); + $this->watchChains[$toLiteral]->unshift($node); } }