Permalink
Browse files

Run php-cs against codebase.

  • Loading branch information...
nrk committed Dec 17, 2013
1 parent fd1c6f2 commit 9d4524cae77dd3a02b2be0664d9191122afabfd1
Showing with 262 additions and 267 deletions.
  1. +1 −1 lib/Predis/BasicClientInterface.php
  2. +26 −23 lib/Predis/Client.php
  3. +2 −2 lib/Predis/ClientInterface.php
  4. +2 −2 lib/Predis/Cluster/CommandHashStrategyInterface.php
  5. +2 −2 lib/Predis/Cluster/Distribution/DistributionStrategyInterface.php
  6. +13 −13 lib/Predis/Cluster/Distribution/HashRing.php
  7. +1 −0 lib/Predis/Cluster/Distribution/KetamaPureRing.php
  8. +1 −1 lib/Predis/Cluster/Hash/HashGeneratorInterface.php
  9. +11 −10 lib/Predis/Cluster/PredisClusterHashStrategy.php
  10. +7 −6 lib/Predis/Cluster/RedisClusterHashStrategy.php
  11. +4 −4 lib/Predis/Collection/Iterator/CursorBasedIterator.php
  12. +2 −2 lib/Predis/Collection/Iterator/ListKey.php
  13. +5 −5 lib/Predis/Command/AbstractCommand.php
  14. +1 −1 lib/Predis/Command/CommandInterface.php
  15. +1 −1 lib/Predis/Command/HashScan.php
  16. +1 −1 lib/Predis/Command/KeyScan.php
  17. +5 −5 lib/Predis/Command/PrefixHelpers.php
  18. +2 −2 lib/Predis/Command/RawCommand.php
  19. +1 −1 lib/Predis/Command/ScriptedCommand.php
  20. +1 −1 lib/Predis/Command/ServerClient.php
  21. +2 −2 lib/Predis/Command/ServerInfo.php
  22. +1 −1 lib/Predis/Command/SetScan.php
  23. +1 −1 lib/Predis/Command/ZSetAdd.php
  24. +2 −1 lib/Predis/Command/ZSetRange.php
  25. +1 −1 lib/Predis/Command/ZSetScan.php
  26. +1 −1 lib/Predis/Command/ZSetUnionStore.php
  27. +4 −4 lib/Predis/CommunicationException.php
  28. +5 −4 lib/Predis/Connection/AbstractConnection.php
  29. +4 −4 lib/Predis/Connection/AggregatedConnectionInterface.php
  30. +1 −1 lib/Predis/Connection/ComposableStreamConnection.php
  31. +1 −2 lib/Predis/Connection/ConnectionFactory.php
  32. +5 −5 lib/Predis/Connection/ConnectionFactoryInterface.php
  33. +2 −2 lib/Predis/Connection/ConnectionInterface.php
  34. +5 −5 lib/Predis/Connection/ConnectionParameters.php
  35. +2 −2 lib/Predis/Connection/ConnectionParametersInterface.php
  36. +5 −4 lib/Predis/Connection/PhpiredisConnection.php
  37. +2 −1 lib/Predis/Connection/PhpiredisStreamConnection.php
  38. +3 −3 lib/Predis/Connection/PredisCluster.php
  39. +12 −12 lib/Predis/Connection/RedisCluster.php
  40. +7 −7 lib/Predis/Connection/StreamConnection.php
  41. +5 −5 lib/Predis/Connection/WebdisConnection.php
  42. +1 −1 lib/Predis/ExecutableContextInterface.php
  43. +2 −2 lib/Predis/Helpers.php
  44. +1 −1 lib/Predis/Iterator/MultiBulkResponse.php
  45. +1 −1 lib/Predis/Iterator/MultiBulkResponseSimple.php
  46. +4 −3 lib/Predis/Option/ClientCluster.php
  47. +4 −4 lib/Predis/Option/ClientOptions.php
  48. +1 −1 lib/Predis/Option/ClientReplication.php
  49. +2 −2 lib/Predis/Option/CustomOption.php
  50. +3 −3 lib/Predis/Option/OptionInterface.php
  51. +4 −4 lib/Predis/Pipeline/MultiExecExecutor.php
  52. +6 −6 lib/Predis/Pipeline/PipelineContext.php
  53. +2 −2 lib/Predis/Pipeline/PipelineExecutorInterface.php
  54. +5 −5 lib/Predis/Pipeline/StandardExecutor.php
  55. +5 −5 lib/Predis/Profile/ServerProfile.php
  56. +4 −4 lib/Predis/Profile/ServerProfileInterface.php
  57. +0 −1 lib/Predis/Profile/ServerVersion20.php
  58. +0 −2 lib/Predis/Profile/ServerVersion22.php
  59. +0 −3 lib/Predis/Profile/ServerVersion24.php
  60. +0 −4 lib/Predis/Profile/ServerVersion26.php
  61. +0 −5 lib/Predis/Profile/ServerVersion28.php
  62. +1 −1 lib/Predis/Protocol/CommandSerializerInterface.php
  63. +2 −2 lib/Predis/Protocol/ProtocolInterface.php
  64. +3 −3 lib/Predis/Protocol/ResponseHandlerInterface.php
  65. +1 −1 lib/Predis/Protocol/ResponseReaderInterface.php
  66. +2 −2 lib/Predis/Protocol/Text/ResponseBulkHandler.php
  67. +2 −2 lib/Predis/Protocol/Text/ResponseIntegerHandler.php
  68. +2 −2 lib/Predis/Protocol/Text/ResponseMultiBulkHandler.php
  69. +2 −2 lib/Predis/Protocol/Text/ResponseMultiBulkStreamHandler.php
  70. +6 −5 lib/Predis/Protocol/Text/TextProtocol.php
  71. +3 −3 lib/Predis/Protocol/Text/TextResponseReader.php
  72. +7 −7 lib/Predis/PubSub/AbstractPubSubContext.php
  73. +2 −2 lib/Predis/PubSub/DispatcherLoop.php
  74. +2 −2 lib/Predis/PubSub/PubSubContext.php
  75. +7 −6 lib/Predis/Replication/ReplicationStrategy.php
  76. +1 −0 lib/Predis/ResponseError.php
  77. +2 −2 lib/Predis/ResponseQueued.php
  78. +2 −5 lib/Predis/Session/SessionHandler.php
  79. +2 −2 lib/Predis/Transaction/AbortedMultiExecException.php
  80. +8 −8 lib/Predis/Transaction/MultiExecContext.php
@@ -24,7 +24,7 @@
/**
* Executes the specified Redis command.
*
- * @param CommandInterface $command A Redis command.
+ * @param CommandInterface $command A Redis command.
* @return mixed
*/
public function executeCommand(CommandInterface $command);
View
@@ -41,7 +41,7 @@ class Client implements ClientInterface
* Initializes a new client with optional connection parameters and client options.
*
* @param mixed $parameters Connection parameters for one or multiple servers.
- * @param mixed $options Options that specify certain behaviours for the client.
+ * @param mixed $options Options that specify certain behaviours for the client.
*/
public function __construct($parameters = null, $options = null)
{
@@ -55,7 +55,7 @@ public function __construct($parameters = null, $options = null)
* arguments (string, array, Predis\Profile\ServerProfile) or returns the
* passed object if it is an instance of Predis\Option\ClientOptions.
*
- * @param mixed $options Client options.
+ * @param mixed $options Client options.
* @return ClientOptions
*/
protected function filterOptions($options)
@@ -80,7 +80,7 @@ protected function filterOptions($options)
* types of arguments (string, array) or returns the passed object if it
* implements Predis\Connection\ConnectionInterface.
*
- * @param mixed $parameters Connection parameters or instance.
+ * @param mixed $parameters Connection parameters or instance.
* @return ConnectionInterface
*/
protected function initializeConnection($parameters)
@@ -202,7 +202,7 @@ public function getConnection()
/**
* Retrieves a single connection out of an aggregated connections instance.
*
- * @param string $connectionId Index or alias of the connection.
+ * @param string $connectionId Index or alias of the connection.
* @return Connection\SingleConnectionInterface
*/
public function getConnectionById($connectionId)
@@ -218,8 +218,8 @@ public function getConnectionById($connectionId)
* Creates a Redis command with the specified arguments and sends a request
* to the server.
*
- * @param string $commandID Command ID.
- * @param array $arguments Arguments for the command.
+ * @param string $commandID Command ID.
+ * @param array $arguments Arguments for the command.
* @return mixed
*/
public function __call($commandID, $arguments)
@@ -259,8 +259,8 @@ public function executeCommand(CommandInterface $command)
/**
* Handles -ERR responses returned by Redis.
*
- * @param CommandInterface $command The command that generated the error.
- * @param ResponseErrorInterface $response The error response instance.
+ * @param CommandInterface $command The command that generated the error.
+ * @param ResponseErrorInterface $response The error response instance.
* @return mixed
*/
protected function onResponseError(CommandInterface $command, ResponseErrorInterface $response)
@@ -290,8 +290,8 @@ protected function onResponseError(CommandInterface $command, ResponseErrorInter
*
* TODO: Invert $argv and $initializer.
*
- * @param array $argv Arguments for the initializer.
- * @param string $initializer The initializer method.
+ * @param array $argv Arguments for the initializer.
+ * @param string $initializer The initializer method.
* @return mixed
*/
private function sharedInitializer($argv, $initializer)
@@ -302,10 +302,12 @@ private function sharedInitializer($argv, $initializer)
case 1:
list($arg0) = $argv;
+
return is_array($arg0) ? $this->$initializer($arg0) : $this->$initializer(null, $arg0);
case 2:
list($arg0, $arg1) = $argv;
+
return $this->$initializer($arg0, $arg1);
default:
@@ -317,7 +319,7 @@ private function sharedInitializer($argv, $initializer)
* Creates a new pipeline context and returns it, or returns the results of
* a pipeline executed inside the optionally provided callable object.
*
- * @param mixed $arg,... Options for the context, a callable object, or both.
+ * @param mixed $arg,... Options for the context, a callable object, or both.
* @return PipelineContext|array
*/
public function pipeline(/* arguments */)
@@ -328,8 +330,8 @@ public function pipeline(/* arguments */)
/**
* Pipeline context initializer.
*
- * @param array $options Options for the context.
- * @param mixed $callable Optional callable object used to execute the context.
+ * @param array $options Options for the context.
+ * @param mixed $callable Optional callable object used to execute the context.
* @return PipelineContext|array
*/
protected function initPipeline(Array $options = null, $callable = null)
@@ -349,8 +351,8 @@ protected function initPipeline(Array $options = null, $callable = null)
/**
* Executes a pipeline context when a callable object is passed.
*
- * @param array $options Options of the context initialization.
- * @param mixed $callable Optional callable object used to execute the context.
+ * @param array $options Options of the context initialization.
+ * @param mixed $callable Optional callable object used to execute the context.
* @return PipelineContext|array
*/
private function pipelineExecute(PipelineContext $pipeline, $callable)
@@ -366,7 +368,7 @@ private function pipelineExecute(PipelineContext $pipeline, $callable)
* as it will replace Client::multiExec() in the next major
* version of the library.
*
- * @param mixed $arg,... Options for the context, a callable object, or both.
+ * @param mixed $arg,... Options for the context, a callable object, or both.
* @return MultiExecContext|array
*/
public function multiExec(/* arguments */)
@@ -378,7 +380,7 @@ public function multiExec(/* arguments */)
* Creates a new transaction context and returns it, or returns the results of
* a transaction executed inside the optionally provided callable object.
*
- * @param mixed $arg,... Options for the context, a callable object, or both.
+ * @param mixed $arg,... Options for the context, a callable object, or both.
* @return MultiExecContext|array
*/
public function transaction(/* arguments */)
@@ -389,13 +391,14 @@ public function transaction(/* arguments */)
/**
* Transaction context initializer.
*
- * @param array $options Options for the context.
- * @param mixed $callable Optional callable object used to execute the context.
+ * @param array $options Options for the context.
+ * @param mixed $callable Optional callable object used to execute the context.
* @return MultiExecContext|array
*/
protected function initMultiExec(Array $options = null, $callable = null)
{
$transaction = new MultiExecContext($this, $options ?: array());
+
return isset($callable) ? $transaction->execute($callable) : $transaction;
}
@@ -408,7 +411,7 @@ protected function initMultiExec(Array $options = null, $callable = null)
* Client::pubSubLoop() to create Predis\PubSub\PubSubContext
* instances from now on.
*
- * @param mixed $arg,... Options for the context, a callable object, or both.
+ * @param mixed $arg,... Options for the context, a callable object, or both.
* @return PubSubExecContext|array
*/
public function pubSub(/* arguments */)
@@ -420,7 +423,7 @@ public function pubSub(/* arguments */)
* Creates a new Publish / Subscribe context and returns it, or executes it
* inside the optionally provided callable object.
*
- * @param mixed $arg,... Options for the context, a callable object, or both.
+ * @param mixed $arg,... Options for the context, a callable object, or both.
* @return PubSubExecContext|array
*/
public function pubSubLoop(/* arguments */)
@@ -431,8 +434,8 @@ public function pubSubLoop(/* arguments */)
/**
* Publish / Subscribe context initializer.
*
- * @param array $options Options for the context.
- * @param mixed $callable Optional callable object used to execute the context.
+ * @param array $options Options for the context.
+ * @param mixed $callable Optional callable object used to execute the context.
* @return PubSubContext
*/
protected function initPubSub(Array $options = null, $callable = null)
@@ -58,8 +58,8 @@ public function getConnection();
/**
* Creates a new instance of the specified Redis command.
*
- * @param string $method The name of a Redis command.
- * @param array $arguments The arguments for the command.
+ * @param string $method The name of a Redis command.
+ * @param array $arguments The arguments for the command.
* @return Command\CommandInterface
*/
public function createCommand($method, $arguments = array());
@@ -27,15 +27,15 @@
* Returns the hash for the given command using the specified algorithm, or null
* if the command cannot be hashed.
*
- * @param CommandInterface $command Command to be hashed.
+ * @param CommandInterface $command Command to be hashed.
* @return int
*/
public function getHash(CommandInterface $command);
/**
* Returns the hash for the given key using the specified algorithm.
*
- * @param string $key Key to be hashed.
+ * @param string $key Key to be hashed.
* @return string
*/
public function getKeyHash($key);
@@ -24,8 +24,8 @@
/**
* Adds a node to the distributor with an optional weight.
*
- * @param mixed $node Node object.
- * @param int $weight Weight for the node.
+ * @param mixed $node Node object.
+ * @param int $weight Weight for the node.
*/
public function add($node, $weight = null);
@@ -34,7 +34,7 @@ class HashRing implements DistributionStrategyInterface, HashGeneratorInterface
private $nodes = array();
/**
- * @param int $replicas Number of replicas in the ring.
+ * @param int $replicas Number of replicas in the ring.
* @param mixed $nodeHashCallback Callback returning the string used to calculate the hash of a node.
*/
public function __construct($replicas = self::DEFAULT_REPLICAS, $nodeHashCallback = null)
@@ -46,8 +46,8 @@ public function __construct($replicas = self::DEFAULT_REPLICAS, $nodeHashCallbac
/**
* Adds a node to the ring with an optional weight.
*
- * @param mixed $node Node object.
- * @param int $weight Weight for the node.
+ * @param mixed $node Node object.
+ * @param int $weight Weight for the node.
*/
public function add($node, $weight = null)
{
@@ -143,10 +143,10 @@ private function initialize()
/**
* Implements the logic needed to add a node to the hashring.
*
- * @param array $ring Source hashring.
- * @param mixed $node Node object to be added.
- * @param int $totalNodes Total number of nodes.
- * @param int $replicas Number of replicas in the ring.
+ * @param array $ring Source hashring.
+ * @param mixed $node Node object to be added.
+ * @param int $totalNodes Total number of nodes.
+ * @param int $replicas Number of replicas in the ring.
* @param float $weightRatio Weight ratio for the node.
*/
protected function addNodeToRing(&$ring, $node, $totalNodes, $replicas, $weightRatio)
@@ -176,7 +176,7 @@ protected function getNodeHash($nodeObject)
/**
* Calculates the hash for the specified value.
*
- * @param string $value Input value.
+ * @param string $value Input value.
* @return int
*/
public function hash($value)
@@ -195,7 +195,7 @@ public function get($key)
/**
* Calculates the corrisponding key of a node distributed in the hashring.
*
- * @param int $key Computed hash of a key.
+ * @param int $key Computed hash of a key.
* @return int
*/
private function getNodeKey($key)
@@ -211,7 +211,7 @@ private function getNodeKey($key)
if ($item > $key) {
$upper = $index - 1;
- } else if ($item < $key) {
+ } elseif ($item < $key) {
$lower = $index + 1;
} else {
return $item;
@@ -224,9 +224,9 @@ private function getNodeKey($key)
/**
* Implements a strategy to deal with wrap-around errors during binary searches.
*
- * @param int $upper
- * @param int $lower
- * @param int $ringKeysCount
+ * @param int $upper
+ * @param int $lower
+ * @param int $ringKeysCount
* @return int
*/
protected function wrapAroundStrategy($upper, $lower, $ringKeysCount)
@@ -55,6 +55,7 @@ protected function addNodeToRing(&$ring, $node, $totalNodes, $replicas, $weightR
public function hash($value)
{
$hash = unpack('V', md5($value, true));
+
return $hash[1];
}
@@ -22,7 +22,7 @@
/**
* Generates an hash that is used by the distributor algorithm
*
- * @param string $value Value used to generate the hash.
+ * @param string $value Value used to generate the hash.
* @return int
*/
public function hash($value);
Oops, something went wrong.

0 comments on commit 9d4524c

Please sign in to comment.