Remove the underscore prefix for names of private/protected fields.

This commit is contained in:
Daniele Alessandri
2011-11-25 12:25:33 +01:00
parent 5d42b41c22
commit 0fee0c6d97
37 changed files with 510 additions and 509 deletions
+10 -10
View File
@@ -20,38 +20,38 @@ use Predis\Network\PredisCluster;
class NaiveDistributionStrategy implements IDistributionStrategy
{
private $_nodes;
private $_nodesCount;
private $nodes;
private $nodesCount;
public function __constructor()
{
$this->_nodes = array();
$this->_nodesCount = 0;
$this->nodes = array();
$this->nodesCount = 0;
}
public function add($node, $weight = null)
{
$this->_nodes[] = $node;
$this->_nodesCount++;
$this->nodes[] = $node;
$this->nodesCount++;
}
public function remove($node)
{
$this->_nodes = array_filter($this->_nodes, function($n) use($node) {
$this->nodes = array_filter($this->nodes, function($n) use($node) {
return $n !== $node;
});
$this->_nodesCount = count($this->_nodes);
$this->nodesCount = count($this->nodes);
}
public function get($key)
{
$count = $this->_nodesCount;
$count = $this->nodesCount;
if ($count === 0) {
throw new RuntimeException('No connections');
}
return $this->_nodes[$count > 1 ? abs(crc32($key) % $count) : 0];
return $this->nodes[$count > 1 ? abs(crc32($key) % $count) : 0];
}
public function generateKey($value)