Fix code smells.

This commit is contained in:
Daniele Alessandri
2014-07-27 20:13:24 +02:00
parent 87aba18002
commit f372029cfc
19 changed files with 61 additions and 3 deletions
+2
View File
@@ -78,6 +78,8 @@ function parseVersion($string)
'max' => $regs[2],
);
}
return null;
}
function addRolePath($pkg, $path, $role)
+1 -3
View File
@@ -53,9 +53,7 @@ class NaiveDistributor implements DistributorInterface, HashGeneratorInterface
public function getBySlot($slot)
{
if (isset($this->nodes[$slot])) {
return $this->nodes[$slot];
}
return isset($this->nodes[$slot]) ? $this->nodes[$slot] : null;
}
public function getByHash($hash)
+2
View File
@@ -484,6 +484,8 @@ class Client implements ClientInterface
$pubsub->stop();
}
}
return null;
}
/**
+12
View File
@@ -232,6 +232,8 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys($arguments)) {
return $arguments[0];
}
return null;
}
/**
@@ -253,6 +255,8 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys($keys)) {
return $arguments[0];
}
return null;
}
/**
@@ -268,6 +272,8 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys(array_slice($arguments, 0, count($arguments) - 1))) {
return $arguments[0];
}
return null;
}
/**
@@ -283,6 +289,8 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys(array_slice($arguments, 1, count($arguments)))) {
return $arguments[1];
}
return null;
}
/**
@@ -299,6 +307,8 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys($keys)) {
return $arguments[0];
}
return null;
}
/**
@@ -318,6 +328,8 @@ abstract class ClusterStrategy implements StrategyInterface
if ($keys && $this->checkSameSlotForKeys($keys)) {
return $keys[0];
}
return null;
}
/**
+2
View File
@@ -204,6 +204,8 @@ class HashRing implements DistributorInterface, HashGeneratorInterface
if (isset($this->ring[$slot])) {
return $this->ring[$slot];
}
return null;
}
/**
+4
View File
@@ -66,6 +66,8 @@ abstract class Command implements CommandInterface
if (isset($this->arguments[$index])) {
return $this->arguments[$index];
}
return null;
}
/**
@@ -84,6 +86,8 @@ abstract class Command implements CommandInterface
if (isset($this->slot)) {
return $this->slot;
}
return null;
}
/**
+4
View File
@@ -97,6 +97,8 @@ class RawCommand implements CommandInterface
if (isset($this->arguments[$index])) {
return $this->arguments[$index];
}
return null;
}
/**
@@ -115,6 +117,8 @@ class RawCommand implements CommandInterface
if (isset($this->slot)) {
return $this->slot;
}
return null;
}
/**
+2
View File
@@ -44,6 +44,8 @@ class ClusterOption implements OptionInterface
return new RedisCluster($options->connections);
}
return null;
}
/**
+4
View File
@@ -63,6 +63,8 @@ class Options implements OptionsInterface
return $handler->getDefault($this);
}
return null;
}
/**
@@ -116,5 +118,7 @@ class Options implements OptionsInterface
if (isset($this->handlers[$option])) {
return $this->options[$option] = $this->getDefault($option);
}
return null;
}
}
@@ -341,6 +341,8 @@ class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
if (isset($this->pool[$connectionID])) {
return $this->pool[$connectionID];
}
return null;
}
/**
@@ -353,6 +355,8 @@ class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
if ($this->pool) {
return $this->pool[array_rand($this->pool)];
}
return null;
}
/**
+2
View File
@@ -111,6 +111,8 @@ class Parameters implements ParametersInterface
if (isset($this->parameters[$parameter])) {
return $this->parameters[$parameter];
}
return null;
}
/**
@@ -364,6 +364,8 @@ class PhpiredisSocketConnection extends AbstractConnection
} else {
$this->onProtocolError(phpiredis_reader_get_error($reader));
}
return null;
}
/**
@@ -201,6 +201,8 @@ class PhpiredisStreamConnection extends StreamConnection
} else {
$this->onProtocolError(phpiredis_reader_get_error($reader));
}
return null;
}
/**
+2
View File
@@ -238,6 +238,8 @@ class StreamConnection extends AbstractConnection
default:
$this->onProtocolError("Unknown response prefix: '$prefix'.");
}
return null;
}
/**
+2
View File
@@ -76,6 +76,8 @@ abstract class RedisProfile implements ProfileInterface
if (isset($this->commands[$commandID = strtoupper($commandID)])) {
return $this->commands[$commandID];
}
return null;
}
/**
@@ -26,7 +26,14 @@ use Predis\Protocol\ResponseReaderInterface;
*/
class CompositeProtocolProcessor implements ProtocolProcessorInterface
{
/*
* @var RequestSerializerInterface
*/
protected $serializer;
/*
* @var ResponseReaderInterface
*/
protected $reader;
/**
@@ -44,5 +44,8 @@ class BulkResponse implements ResponseHandlerInterface
if ($length == -1) {
return null;
}
// TODO: we should probably check if < -1, just to make sure.
return null;
}
}
+2
View File
@@ -98,6 +98,8 @@ class ProtocolProcessor implements ProtocolProcessorInterface
CommunicationException::handle(new ProtocolException(
$connection, "Unknown response prefix: '$prefix'."
));
return null;
}
}
+2
View File
@@ -72,6 +72,8 @@ class ResponseReader implements ResponseReaderInterface
if (isset($this->handlers[$prefix])) {
return $this->handlers[$prefix];
}
return null;
}
/**