Quellcode durchsuchen

Big batch of phpdoc improvements and minor code styling fixes.

Daniele Alessandri vor 11 Jahren
Ursprung
Commit
59b5658cf5
77 geänderte Dateien mit 361 neuen und 336 gelöschten Zeilen
  1. 1 1
      lib/Predis/Autoloader.php
  2. 3 3
      lib/Predis/BasicClientInterface.php
  3. 6 3
      lib/Predis/Client.php
  4. 6 7
      lib/Predis/ClientInterface.php
  5. 2 2
      lib/Predis/Cluster/Distributor/DistributorInterface.php
  6. 1 1
      lib/Predis/Cluster/Distributor/HashRing.php
  7. 1 1
      lib/Predis/Cluster/Distributor/KetamaRing.php
  8. 1 1
      lib/Predis/Cluster/Hash/CRC16.php
  9. 4 4
      lib/Predis/Cluster/Hash/HashGeneratorInterface.php
  10. 16 16
      lib/Predis/Cluster/PredisStrategy.php
  11. 13 11
      lib/Predis/Cluster/RedisStrategy.php
  12. 6 6
      lib/Predis/Cluster/StrategyInterface.php
  13. 16 15
      lib/Predis/Collection/Iterator/CursorBasedIterator.php
  14. 2 3
      lib/Predis/Collection/Iterator/HashKey.php
  15. 2 3
      lib/Predis/Collection/Iterator/Keyspace.php
  16. 12 9
      lib/Predis/Collection/Iterator/ListKey.php
  17. 2 3
      lib/Predis/Collection/Iterator/SetKey.php
  18. 2 3
      lib/Predis/Collection/Iterator/SortedSetKey.php
  19. 3 2
      lib/Predis/Command/CommandInterface.php
  20. 4 4
      lib/Predis/Command/Processor/CommandProcessorChainInterface.php
  21. 3 3
      lib/Predis/Command/Processor/CommandProcessorInterface.php
  22. 2 2
      lib/Predis/Command/Processor/KeyPrefixProcessor.php
  23. 2 2
      lib/Predis/Command/ScriptCommand.php
  24. 5 3
      lib/Predis/CommunicationException.php
  25. 2 2
      lib/Predis/Configuration/ConnectionFactoryOption.php
  26. 2 3
      lib/Predis/Configuration/ExceptionsOption.php
  27. 2 2
      lib/Predis/Configuration/OptionInterface.php
  28. 2 2
      lib/Predis/Configuration/Options.php
  29. 4 6
      lib/Predis/Configuration/OptionsInterface.php
  30. 2 3
      lib/Predis/Configuration/PrefixOption.php
  31. 3 4
      lib/Predis/Configuration/ProfileOption.php
  32. 12 7
      lib/Predis/Configuration/ReplicationOption.php
  33. 4 3
      lib/Predis/Connection/AbstractConnection.php
  34. 12 13
      lib/Predis/Connection/AggregatedConnectionInterface.php
  35. 2 2
      lib/Predis/Connection/ClusterConnectionInterface.php
  36. 5 6
      lib/Predis/Connection/ComposableConnectionInterface.php
  37. 1 1
      lib/Predis/Connection/ComposableStreamConnection.php
  38. 3 4
      lib/Predis/Connection/ConnectionFactory.php
  39. 8 9
      lib/Predis/Connection/ConnectionFactoryInterface.php
  40. 11 10
      lib/Predis/Connection/ConnectionInterface.php
  41. 1 1
      lib/Predis/Connection/ConnectionParameters.php
  42. 8 4
      lib/Predis/Connection/MasterSlaveReplication.php
  43. 10 10
      lib/Predis/Connection/PredisCluster.php
  44. 2 1
      lib/Predis/Connection/RedisCluster.php
  45. 6 5
      lib/Predis/Connection/ReplicationConnectionInterface.php
  46. 5 5
      lib/Predis/Connection/SingleConnectionInterface.php
  47. 7 7
      lib/Predis/Connection/StreamConnection.php
  48. 9 9
      lib/Predis/Connection/WebdisConnection.php
  49. 2 2
      lib/Predis/ExecutableContextInterface.php
  50. 5 5
      lib/Predis/Monitor/Consumer.php
  51. 2 2
      lib/Predis/NotSupportedException.php
  52. 6 6
      lib/Predis/Pipeline/Pipeline.php
  53. 4 2
      lib/Predis/Profile/Factory.php
  54. 5 5
      lib/Predis/Profile/RedisProfile.php
  55. 1 1
      lib/Predis/Profile/RedisVersion120.php
  56. 1 1
      lib/Predis/Profile/RedisVersion200.php
  57. 1 1
      lib/Predis/Profile/RedisVersion220.php
  58. 1 1
      lib/Predis/Profile/RedisVersion240.php
  59. 1 1
      lib/Predis/Profile/RedisVersion260.php
  60. 1 1
      lib/Predis/Profile/RedisVersion280.php
  61. 2 1
      lib/Predis/Protocol/ProtocolException.php
  62. 5 5
      lib/Predis/Protocol/ProtocolProcessorInterface.php
  63. 2 2
      lib/Predis/Protocol/ResponseReaderInterface.php
  64. 4 4
      lib/Predis/Protocol/Text/Handler/ResponseHandlerInterface.php
  65. 3 3
      lib/Predis/Protocol/Text/Handler/StatusResponse.php
  66. 2 2
      lib/Predis/Protocol/Text/ProtocolProcessor.php
  67. 2 2
      lib/Predis/Protocol/Text/ResponseReader.php
  68. 9 10
      lib/Predis/PubSub/AbstractConsumer.php
  69. 2 2
      lib/Predis/PubSub/Consumer.php
  70. 7 7
      lib/Predis/PubSub/DispatcherLoop.php
  71. 21 18
      lib/Predis/Replication/ReplicationStrategy.php
  72. 3 3
      lib/Predis/Response/Iterator/MultiBulk.php
  73. 6 2
      lib/Predis/Response/Iterator/MultiBulkTuple.php
  74. 3 3
      lib/Predis/Response/Status.php
  75. 10 5
      lib/Predis/Session/Handler.php
  76. 1 1
      lib/Predis/Transaction/AbortedMultiExecException.php
  77. 11 11
      lib/Predis/Transaction/MultiExec.php

+ 1 - 1
lib/Predis/Autoloader.php

@@ -12,7 +12,7 @@
 namespace Predis;
 
 /**
- * Implements a lightweight PSR-0 compliant autoloader.
+ * Implements a lightweight PSR-0 compliant autoloader for Predis.
  *
  * @author Eric Naeseth <eric@thumbtack.com>
  * @author Daniele Alessandri <suppakilla@gmail.com>

+ 3 - 3
lib/Predis/BasicClientInterface.php

@@ -14,8 +14,8 @@ namespace Predis;
 use Predis\Command\CommandInterface;
 
 /**
- * Defines the interface of a basic client object or abstraction that
- * can send commands to Redis.
+ * Defines the interface of a basic client class or abstraction that can send
+ * commands to Redis.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -24,7 +24,7 @@ interface BasicClientInterface
     /**
      * Executes the specified Redis command.
      *
-     * @param CommandInterface $command A Redis command.
+     * @param CommandInterface $command Command instance.
      * @return mixed
      */
     public function executeCommand(CommandInterface $command);

+ 6 - 3
lib/Predis/Client.php

@@ -147,7 +147,9 @@ class Client implements ClientInterface
             $connection = call_user_func_array($callable, func_get_args());
 
             if (!$connection instanceof ConnectionInterface) {
-                throw new UnexpectedValueException('The callable connection initializer returned an invalid type');
+                throw new UnexpectedValueException(
+                    'The callable connection initializer returned an invalid type'
+                );
             }
 
             return $connection;
@@ -367,8 +369,9 @@ class Client implements ClientInterface
                 return $this->$initializer();
 
             case 1:
-                list($arg0) = $argv;
-                return is_array($arg0) ? $this->$initializer($arg0) : $this->$initializer(null, $arg0);
+                return is_array($argv[0])
+                    ? $this->$initializer($argv[0])
+                    : $this->$initializer(null, $argv[0]);
 
             case 2:
                 list($arg0, $arg1) = $argv;

+ 6 - 7
lib/Predis/ClientInterface.php

@@ -17,9 +17,8 @@ use Predis\Connection\ConnectionInterface;
 use Predis\Profile\ProfileInterface;
 
 /**
- * Interface defining the most important parts needed to create an
- * high-level Redis client object that can interact with other
- * building blocks of Predis.
+ * Interface defining the most important methods needed to create an high-level
+ * Redis client that can interact with other building blocks of Predis.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -40,12 +39,12 @@ interface ClientInterface extends BasicClientInterface
     public function getOptions();
 
     /**
-     * Opens the connection to the server.
+     * Opens the underlying connection to the server.
      */
     public function connect();
 
     /**
-     * Disconnects from the server.
+     * Closes the underlying connection from the server.
      */
     public function disconnect();
 
@@ -59,8 +58,8 @@ interface ClientInterface extends BasicClientInterface
     /**
      * 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 Command ID.
+     * @param array $arguments Arguments for the command.
      * @return CommandInterface
      */
     public function createCommand($method, $arguments = array());

+ 2 - 2
lib/Predis/Cluster/Distributor/DistributorInterface.php

@@ -14,7 +14,7 @@ namespace Predis\Cluster\Distributor;
 use Predis\Cluster\Hash\HashGeneratorInterface;
 
 /**
- * Distributors implement the logic to automatically distribute keys among
+ * A distributor implements the logic to automatically distribute keys among
  * several nodes for client-side sharding.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
@@ -37,7 +37,7 @@ interface DistributorInterface
     public function remove($node);
 
     /**
-     * Gets a node from the distributor using the computed hash of a key.
+     * Returns a node from the distributor using the computed hash of a key.
      *
      * @return mixed
      */

+ 1 - 1
lib/Predis/Cluster/Distributor/HashRing.php

@@ -35,7 +35,7 @@ class HashRing implements DistributorInterface, HashGeneratorInterface
 
     /**
      * @param int $replicas Number of replicas in the ring.
-     * @param mixed $nodeHashCallback Callback returning the string used to calculate the hash of a node.
+     * @param mixed $nodeHashCallback Callback returning a string used to calculate the hash of nodes.
      */
     public function __construct($replicas = self::DEFAULT_REPLICAS, $nodeHashCallback = null)
     {

+ 1 - 1
lib/Predis/Cluster/Distributor/KetamaRing.php

@@ -24,7 +24,7 @@ class KetamaRing extends HashRing
     const DEFAULT_REPLICAS = 160;
 
     /**
-     * @param mixed $nodeHashCallback Callback returning the string used to calculate the hash of a node.
+     * @param mixed $nodeHashCallback Callback returning a string used to calculate the hash of nodes.
      */
     public function __construct($nodeHashCallback = null)
     {

+ 1 - 1
lib/Predis/Cluster/Hash/CRC16.php

@@ -12,7 +12,7 @@
 namespace Predis\Cluster\Hash;
 
 /**
- * This class implements the CRC-CCITT-16 algorithm used by redis-cluster.
+ * Hash generator implementing the CRC-CCITT-16 algorithm used by redis-cluster.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 4 - 4
lib/Predis/Cluster/Hash/HashGeneratorInterface.php

@@ -12,17 +12,17 @@
 namespace Predis\Cluster\Hash;
 
 /**
- * A generator of node keys implements the logic used to calculate the hash of
- * a key to distribute the respective operations among nodes.
+ * An hash generator implements the logic used to calculate the hash of a key to
+ * distribute operations among Redis nodes.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
 interface HashGeneratorInterface
 {
     /**
-     * Generates an hash that is used by the distributor algorithm
+     * Generates an hash from a string to be used for distribution.
      *
-     * @param string $value Value used to generate the hash.
+     * @param string $value String value.
      * @return int
      */
     public function hash($value);

+ 16 - 16
lib/Predis/Cluster/PredisStrategy.php

@@ -16,8 +16,8 @@ use Predis\Command\CommandInterface;
 use Predis\Command\ScriptCommand;
 
 /**
- * Default class used by Predis for client-side sharding to calculate
- * hashes out of keys of supported commands.
+ * Default class used by Predis for client-side sharding to calculate hashes out
+ * of keys for supported commands.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -173,21 +173,21 @@ class PredisStrategy implements StrategyInterface
     /**
      * Sets an handler for the specified command ID.
      *
-     * The signature of the callback must have a single parameter
-     * of type Predis\Command\CommandInterface.
+     * The signature of the callback must have a single parameter of type
+     * Predis\Command\CommandInterface.
      *
-     * When the callback argument is omitted or NULL, the previously
-     * associated handler for the specified command ID is removed.
+     * When the callback argument is omitted or NULL, the previously associated
+     * handler for the specified command ID is removed.
      *
-     * @param string $commandId The ID of the command to be handled.
-     * @param mixed $callback A valid callable object or NULL.
+     * @param string $commandID Command ID.
+     * @param mixed $callback A valid callable object, or NULL to unset the handler.
      */
-    public function setCommandHandler($commandId, $callback = null)
+    public function setCommandHandler($commandID, $callback = null)
     {
-        $commandId = strtoupper($commandId);
+        $commandID = strtoupper($commandID);
 
         if (!isset($callback)) {
-            unset($this->commands[$commandId]);
+            unset($this->commands[$commandID]);
             return;
         }
 
@@ -195,7 +195,7 @@ class PredisStrategy implements StrategyInterface
             throw new \InvalidArgumentException("Callback must be a valid callable object or NULL");
         }
 
-        $this->commands[$commandId] = $callback;
+        $this->commands[$commandID] = $callback;
     }
 
     /**
@@ -210,8 +210,8 @@ class PredisStrategy implements StrategyInterface
     }
 
     /**
-     * Extracts the key from a command with multiple keys only when all keys
-     * in the arguments array produce the same hash.
+     * Extracts the key from a command with multiple keys only when all keys in
+     * the arguments array produce the same hash.
      *
      * @param CommandInterface $command Command instance.
      * @return string
@@ -226,8 +226,8 @@ class PredisStrategy implements StrategyInterface
     }
 
     /**
-     * Extracts the key from a command with multiple keys only when all keys
-     * in the arguments array produce the same hash.
+     * Extracts the key from a command with multiple keys only when all keys in
+     * the arguments array produce the same hash.
      *
      * @param CommandInterface $command Command instance.
      * @return string

+ 13 - 11
lib/Predis/Cluster/RedisStrategy.php

@@ -158,29 +158,31 @@ class RedisStrategy implements StrategyInterface
     /**
      * Sets an handler for the specified command ID.
      *
-     * The signature of the callback must have a single parameter
-     * of type Predis\Command\CommandInterface.
+     * The signature of the callback must have a single parameter of type
+     * Predis\Command\CommandInterface.
      *
-     * When the callback argument is omitted or NULL, the previously
-     * associated handler for the specified command ID is removed.
+     * When the callback argument is omitted or NULL, the previously associated
+     * handler for the specified command ID is removed.
      *
-     * @param string $commandId The ID of the command to be handled.
-     * @param mixed $callback A valid callable object or NULL.
+     * @param string $commandID Command ID.
+     * @param mixed $callback A valid callable object, or NULL to unset the handler.
      */
-    public function setCommandHandler($commandId, $callback = null)
+    public function setCommandHandler($commandID, $callback = null)
     {
-        $commandId = strtoupper($commandId);
+        $commandID = strtoupper($commandID);
 
         if (!isset($callback)) {
-            unset($this->commands[$commandId]);
+            unset($this->commands[$commandID]);
             return;
         }
 
         if (!is_callable($callback)) {
-            throw new \InvalidArgumentException("Callback must be a valid callable object or NULL");
+            throw new \InvalidArgumentException(
+                "Callback must be a valid callable object or NULL"
+            );
         }
 
-        $this->commands[$commandId] = $callback;
+        $this->commands[$commandID] = $callback;
     }
 
     /**

+ 6 - 6
lib/Predis/Cluster/StrategyInterface.php

@@ -14,8 +14,8 @@ namespace Predis\Cluster;
 use Predis\Command\CommandInterface;
 
 /**
- * Interface for classes defining the strategy used to calculate an hash
- * out of keys extracted from supported commands.
+ * Interface for classes defining the strategy used to calculate an hash out of
+ * keys extracted from supported commands.
  *
  * This is mostly useful to support clustering via client-side sharding.
  *
@@ -24,10 +24,10 @@ use Predis\Command\CommandInterface;
 interface StrategyInterface
 {
     /**
-     * Returns the hash for the given command using the specified algorithm, or null
-     * if the command cannot be hashed.
+     * Returns the hash for the given command using the specified algorithm, or
+     * null when the command cannot be hashed.
      *
-     * @param CommandInterface $command Command to be hashed.
+     * @param CommandInterface $command Command instance.
      * @return int
      */
     public function getHash(CommandInterface $command);
@@ -35,7 +35,7 @@ interface StrategyInterface
     /**
      * Returns the hash for the given key using the specified algorithm.
      *
-     * @param string $key Key to be hashed.
+     * @param string $key Key string.
      * @return string
      */
     public function getKeyHash($key);

+ 16 - 15
lib/Predis/Collection/Iterator/CursorBasedIterator.php

@@ -16,13 +16,13 @@ use Predis\ClientInterface;
 use Predis\NotSupportedException;
 
 /**
- * Provides the base implementation for a fully-rewindable PHP iterator
- * that can incrementally iterate over cursor-based collections stored
- * on Redis using commands in the `SCAN` family.
+ * Provides the base implementation for a fully-rewindable PHP iterator that can
+ * incrementally iterate over cursor-based collections stored on Redis using the
+ * commands in the `SCAN` family.
  *
- * Given their incremental nature with multiple fetches, these kind of
- * iterators offer limited guarantees about the returned elements because
- * the collection can change several times during the iteration process.
+ * Given their incremental nature with multiple fetches, these kind of iterators
+ * offer limited guarantees about the returned elements because the collection
+ * can change several times during the iteration process.
  *
  * @see http://redis.io/commands/scan
  *
@@ -44,7 +44,7 @@ abstract class CursorBasedIterator implements Iterator
     /**
      * @param ClientInterface $client Client connected to Redis.
      * @param string $match Pattern to match during the server-side iteration.
-     * @param int $count Hints used by Redis to compute the number of results per iteration.
+     * @param int $count Hint used by Redis to compute the number of results per iteration.
      */
     public function __construct(ClientInterface $client, $match = null, $count = null)
     {
@@ -56,9 +56,8 @@ abstract class CursorBasedIterator implements Iterator
     }
 
     /**
-     * Ensures that the client instance supports the specified Redis
-     * command required to fetch elements from the server to perform
-     * the iteration.
+     * Ensures that the client supports the specified Redis command required to
+     * fetch elements from the server to perform the iteration.
      *
      * @param ClientInterface Client connected to Redis.
      * @param string $commandID Command ID.
@@ -66,7 +65,9 @@ abstract class CursorBasedIterator implements Iterator
     protected function requiredCommand(ClientInterface $client, $commandID)
     {
         if (!$client->getProfile()->supportsCommand($commandID)) {
-            throw new NotSupportedException("The specified server profile does not support the `$commandID` command.");
+            throw new NotSupportedException(
+                "The specified server profile does not support the `$commandID` command."
+            );
         }
     }
 
@@ -104,16 +105,16 @@ abstract class CursorBasedIterator implements Iterator
     }
 
     /**
-     * Fetches a new set of elements from the remote collection,
-     * effectively advancing the iteration process.
+     * Fetches a new set of elements from the remote collection, effectively
+     * advancing the iteration process.
      *
      * @return array
      */
     protected abstract function executeCommand();
 
     /**
-     * Populates the local buffer of elements fetched from the
-     * server during the iteration.
+     * Populates the local buffer of elements fetched from the server during
+     * the iteration.
      */
     protected function fetch()
     {

+ 2 - 3
lib/Predis/Collection/Iterator/HashKey.php

@@ -14,9 +14,8 @@ namespace Predis\Collection\Iterator;
 use Predis\ClientInterface;
 
 /**
- * Abstracts the iteration of fields and values of an hash
- * by leveraging the HSCAN command (Redis >= 2.8) wrapped
- * in a fully-rewindable PHP iterator.
+ * Abstracts the iteration of fields and values of an hash by leveraging the
+ * HSCAN command (Redis >= 2.8) wrapped in a fully-rewindable PHP iterator.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  * @link http://redis.io/commands/scan

+ 2 - 3
lib/Predis/Collection/Iterator/Keyspace.php

@@ -14,9 +14,8 @@ namespace Predis\Collection\Iterator;
 use Predis\ClientInterface;
 
 /**
- * Abstracts the iteration of the keyspace on a Redis instance
- * by leveraging the SCAN command (Redis >= 2.8) wrapped in a
- * fully-rewindable PHP iterator.
+ * Abstracts the iteration of the keyspace on a Redis instance by leveraging the
+ * SCAN command (Redis >= 2.8) wrapped in a fully-rewindable PHP iterator.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  * @link http://redis.io/commands/scan

+ 12 - 9
lib/Predis/Collection/Iterator/ListKey.php

@@ -51,7 +51,9 @@ class ListKey implements Iterator
         $this->requiredCommand($client, 'LRANGE');
 
         if ((false === $count = filter_var($count, FILTER_VALIDATE_INT)) || $count < 0) {
-            throw new InvalidArgumentException('The $count argument must be a positive integer.');
+            throw new InvalidArgumentException(
+                'The $count argument must be a positive integer.'
+            );
         }
 
         $this->client = $client;
@@ -62,9 +64,8 @@ class ListKey implements Iterator
     }
 
     /**
-     * Ensures that the client instance supports the specified Redis
-     * command required to fetch elements from the server to perform
-     * the iteration.
+     * Ensures that the client instance supports the specified Redis command
+     * required to fetch elements from the server to perform the iteration.
      *
      * @param ClientInterface Client connected to Redis.
      * @param string $commandID Command ID.
@@ -72,7 +73,9 @@ class ListKey implements Iterator
     protected function requiredCommand(ClientInterface $client, $commandID)
     {
         if (!$client->getProfile()->supportsCommand($commandID)) {
-            throw new NotSupportedException("The specified server profile does not support the `$commandID` command.");
+            throw new NotSupportedException(
+                "The specified server profile does not support the `$commandID` command."
+            );
         }
     }
 
@@ -89,8 +92,8 @@ class ListKey implements Iterator
     }
 
     /**
-     * Fetches a new set of elements from the remote collection,
-     * effectively advancing the iteration process.
+     * Fetches a new set of elements from the remote collection, effectively
+     * advancing the iteration process.
      *
      * @return array
      */
@@ -100,8 +103,8 @@ class ListKey implements Iterator
     }
 
     /**
-     * Populates the local buffer of elements fetched from the
-     * server during the iteration.
+     * Populates the local buffer of elements fetched from the server during the
+     * iteration.
      */
     protected function fetch()
     {

+ 2 - 3
lib/Predis/Collection/Iterator/SetKey.php

@@ -14,9 +14,8 @@ namespace Predis\Collection\Iterator;
 use Predis\ClientInterface;
 
 /**
- * Abstracts the iteration of members stored in a set by
- * leveraging the SSCAN command (Redis >= 2.8) wrapped in
- * a fully-rewindable PHP iterator.
+ * Abstracts the iteration of members stored in a set by leveraging the SSCAN
+ * command (Redis >= 2.8) wrapped in a fully-rewindable PHP iterator.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  * @link http://redis.io/commands/scan

+ 2 - 3
lib/Predis/Collection/Iterator/SortedSetKey.php

@@ -14,9 +14,8 @@ namespace Predis\Collection\Iterator;
 use Predis\ClientInterface;
 
 /**
- * Abstracts the iteration of members stored in a sorted set
- * by leveraging the ZSCAN command (Redis >= 2.8) wrapped in
- * a fully-rewindable PHP iterator.
+ * Abstracts the iteration of members stored in a sorted set by leveraging the
+ * ZSCAN command (Redis >= 2.8) wrapped in a fully-rewindable PHP iterator.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  * @link http://redis.io/commands/scan

+ 3 - 2
lib/Predis/Command/CommandInterface.php

@@ -13,13 +13,14 @@ namespace Predis\Command;
 
 /**
  * Defines an abstraction representing a Redis command.
+ *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
 interface CommandInterface
 {
     /**
-     * Gets the ID of a Redis command.
-     * By convention, command identifiers myst be uppercase.
+     * Returns the ID of the Redis command. By convention, command identifiers
+     * must always be uppercase.
      *
      * @return string
      */

+ 4 - 4
lib/Predis/Command/Processor/CommandProcessorChainInterface.php

@@ -20,16 +20,16 @@ namespace Predis\Command\Processor;
 interface CommandProcessorChainInterface extends CommandProcessorInterface, \IteratorAggregate, \Countable
 {
     /**
-     * Adds a command processor.
+     * Adds the given command processor.
      *
-     * @param CommandProcessorInterface $processor A command processor.
+     * @param CommandProcessorInterface $processor Command processor.
      */
     public function add(CommandProcessorInterface $processor);
 
     /**
-     * Removes a command processor from the chain.
+     * Removes the given command processor from the chain if previously added.
      *
-     * @param CommandProcessorInterface $processor A command processor.
+     * @param CommandProcessorInterface $processor Command processor.
      */
     public function remove(CommandProcessorInterface $processor);
 

+ 3 - 3
lib/Predis/Command/Processor/CommandProcessorInterface.php

@@ -14,16 +14,16 @@ namespace Predis\Command\Processor;
 use Predis\Command\CommandInterface;
 
 /**
- * A command processor processes commands before they are sent to Redis.
+ * Command processor process Redis commands before they are sent to Redis.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
 interface CommandProcessorInterface
 {
     /**
-     * Processes a Redis command.
+     * Processes the given Redis command.
      *
-     * @param CommandInterface $command Redis command.
+     * @param CommandInterface $command Command instance.
      */
     public function process(CommandInterface $command);
 }

+ 2 - 2
lib/Predis/Command/Processor/KeyPrefixProcessor.php

@@ -15,8 +15,8 @@ use Predis\Command\CommandInterface;
 use Predis\Command\PrefixableCommandInterface;
 
 /**
- * Command processor that is used to prefix the keys contained in the arguments
- * of a Redis command.
+ * Command processor used to prefix the keys contained in the arguments of a
+ * Redis command.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 2 - 2
lib/Predis/Command/ScriptCommand.php

@@ -12,8 +12,8 @@
 namespace Predis\Command;
 
 /**
- * Base class used to implement an higher level abstraction for "virtual"
- * commands for Lua scripting based on EVAL and EVALSHA.
+ * Base class used to implement an higher level abstraction for commands based
+ * on Lua scripting with EVAL and EVALSHA.
  *
  * @link http://redis.io/commands/eval
  * @author Daniele Alessandri <suppakilla@gmail.com>

+ 5 - 3
lib/Predis/CommunicationException.php

@@ -29,7 +29,10 @@ abstract class CommunicationException extends PredisException
      * @param \Exception $innerException Inner exception for wrapping the original error.
      */
     public function __construct(
-        SingleConnectionInterface $connection, $message = null, $code = null, \Exception $innerException = null
+        SingleConnectionInterface $connection,
+        $message = null,
+        $code = null,
+        \Exception $innerException = null
     ) {
         parent::__construct($message, $code, $innerException);
         $this->connection = $connection;
@@ -56,8 +59,7 @@ abstract class CommunicationException extends PredisException
     }
 
     /**
-     * Offers a generic and reusable method to handle exceptions generated by
-     * a connection object.
+     * Helper method to handle exceptions generated by a connection object.
      *
      * @param CommunicationException $exception Exception.
      */

+ 2 - 2
lib/Predis/Configuration/ConnectionFactoryOption.php

@@ -16,8 +16,8 @@ use Predis\Connection\ConnectionFactory;
 use Predis\Connection\ConnectionFactoryInterface;
 
 /**
- * Configures a connection factory used by the client to
- * create new connection instances to single Redis nodes.
+ * Configures a connection factory used by the client to create new connection
+ * instances for single Redis nodes.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 2 - 3
lib/Predis/Configuration/ExceptionsOption.php

@@ -12,9 +12,8 @@
 namespace Predis\Configuration;
 
 /**
- * Configures whether consumers (such as the client) should
- * throw exceptions on Redis errors (-ERR responses) or just
- * return error objects.
+ * Configures whether consumers (such as the client) should throw exceptions on
+ * Redis errors (-ERR responses) or just return instances of error responses.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 2 - 2
lib/Predis/Configuration/OptionInterface.php

@@ -12,8 +12,8 @@
 namespace Predis\Configuration;
 
 /**
- * Defines an handler used by Predis\Configuration\Options to
- * filter, validate or get default values for a given option.
+ * Defines an handler used by Predis\Configuration\Options to filter, validate
+ * or return default values for a given option.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 2 - 2
lib/Predis/Configuration/Options.php

@@ -12,8 +12,8 @@
 namespace Predis\Configuration;
 
 /**
- * Manages Predis options with filtering, conversion and lazy
- * initialization of values using a mini DI container approach.
+ * Manages Predis options with filtering, conversion and lazy initialization of
+ * values using a mini-DI container approach.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 4 - 6
lib/Predis/Configuration/OptionsInterface.php

@@ -19,7 +19,7 @@ namespace Predis\Configuration;
 interface OptionsInterface
 {
     /**
-     * Returns the default value for the specified option.
+     * Returns the default value for the given option.
      *
      * @param string $option Name of the option.
      * @return mixed
@@ -27,8 +27,7 @@ interface OptionsInterface
     public function getDefault($option);
 
     /**
-     * Checks if the specified option has been passed by
-     * the user at construction time.
+     * Checks if the given option has been set by the user upon initialization.
      *
      * @param string $option Name of the option.
      * @return bool
@@ -36,8 +35,7 @@ interface OptionsInterface
     public function defined($option);
 
     /**
-     * Checks if the specified option has been set and
-     * does not evaluate to NULL.
+     * Checks if the given option has been set and does not evaluate to NULL.
      *
      * @param string $option Name of the option.
      * @return bool
@@ -45,7 +43,7 @@ interface OptionsInterface
     public function __isset($option);
 
     /**
-     * Returns the value of the specified option.
+     * Returns the value of the given option.
      *
      * @param string $option Name of the option.
      * @return mixed

+ 2 - 3
lib/Predis/Configuration/PrefixOption.php

@@ -15,9 +15,8 @@ use Predis\Command\Processor\KeyPrefixProcessor;
 use Predis\Command\Processor\CommandProcessorInterface;
 
 /**
- * Configures a command processor that apply the specified
- * prefix string to a series of Redis commands considered
- * prefixable.
+ * Configures a command processor that apply the specified prefix string to a
+ * series of Redis commands considered prefixable.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 3 - 4
lib/Predis/Configuration/ProfileOption.php

@@ -15,16 +15,15 @@ use InvalidArgumentException;
 use Predis\Profile;
 
 /**
- * Configures the server profile to be used by the client
- * to create command instances depending on the specified
- * version of the Redis server.
+ * Configures the server profile to be used by the client to create command
+ * instances depending on the specified version of the Redis server.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
 class ProfileOption implements OptionInterface
 {
     /**
-     * Sets the needed commands processors that should be applied to the profile.
+     * Sets the commands processors that need to be applied to the profile.
      *
      * @param OptionsInterface $options Client options.
      * @param Profile\ProfileInterface $profile Server profile.

+ 12 - 7
lib/Predis/Configuration/ReplicationOption.php

@@ -16,8 +16,8 @@ use Predis\Connection\MasterSlaveReplication;
 use Predis\Connection\ReplicationConnectionInterface;
 
 /**
- * Configures an aggregate connection used for master/slave
- * replication between multiple nodes.
+ * Configures an aggregate connection used for master/slave replication between
+ * multiple Redis nodes.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -26,9 +26,9 @@ class ReplicationOption implements OptionInterface
     /**
      * {@inheritdoc}
      *
-     * @todo There's more code than needed due to a bug in filter_var()
-     *       as discussed here https://bugs.php.net/bug.php?id=49510
-     *       and a different behaviour with NULL values on PHP 5.3.
+     * @todo There's more code than needed due to a bug in filter_var() as
+     *       discussed here https://bugs.php.net/bug.php?id=49510 and  different
+     *       behaviours when encountering NULL values on PHP 5.3.
      */
     public function filter(OptionsInterface $options, $value)
     {
@@ -40,11 +40,16 @@ class ReplicationOption implements OptionInterface
             return $value ? $this->getDefault($options) : null;
         }
 
-        if (!is_object($value) && null !== $asbool = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)) {
+        if (
+            !is_object($value) &&
+            null !== $asbool = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)
+        ) {
             return $asbool ? $this->getDefault($options) : null;
         }
 
-        throw new InvalidArgumentException('Instance of Predis\Connection\ReplicationConnectionInterface expected');
+        throw new InvalidArgumentException(
+            'Instance of Predis\Connection\ReplicationConnectionInterface expected'
+        );
     }
 
     /**

+ 4 - 3
lib/Predis/Connection/AbstractConnection.php

@@ -19,7 +19,8 @@ use Predis\Command\CommandInterface;
 use Predis\Protocol\ProtocolException;
 
 /**
- * Base class with the common logic used by connection classes to communicate with Redis.
+ * Base class with the common logic used by connection classes to communicate
+ * with Redis.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -32,7 +33,7 @@ abstract class AbstractConnection implements SingleConnectionInterface
     protected $initCmds = array();
 
     /**
-     * @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
+     * @param ConnectionParametersInterface $parameters Initialization parameters for the connection.
      */
     public function __construct(ConnectionParametersInterface $parameters)
     {
@@ -51,7 +52,7 @@ abstract class AbstractConnection implements SingleConnectionInterface
     /**
      * Checks some of the parameters used to initialize the connection.
      *
-     * @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
+     * @param ConnectionParametersInterface $parameters Initialization parameters for the connection.
      */
     protected function assertParameters(ConnectionParametersInterface $parameters)
     {

+ 12 - 13
lib/Predis/Connection/AggregatedConnectionInterface.php

@@ -14,42 +14,41 @@ namespace Predis\Connection;
 use Predis\Command\CommandInterface;
 
 /**
- * Defines a virtual connection composed by multiple connection objects.
+ * Defines a virtual connection composed of multiple connection instances to
+ * single Redis nodes.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
 interface AggregatedConnectionInterface extends ConnectionInterface
 {
     /**
-     * Adds a connection instance to the aggregated connection.
+     * Adds a connection instance to the aggregate connection.
      *
-     * @param SingleConnectionInterface $connection Instance of a connection.
+     * @param SingleConnectionInterface $connection Connection instance.
      */
     public function add(SingleConnectionInterface $connection);
 
     /**
-     * Removes the specified connection instance from the aggregated
-     * connection.
+     * Removes the specified connection instance from the aggregate connection.
      *
-     * @param SingleConnectionInterface $connection Instance of a connection.
-     * @return Boolean Returns true if the connection was in the pool.
+     * @param SingleConnectionInterface $connection Connection instance.
+     * @return bool Returns true if the connection was in the pool.
      */
     public function remove(SingleConnectionInterface $connection);
 
     /**
-     * Gets the actual connection instance in charge of the specified command.
+     * Returns the connection instance in charge for the given command.
      *
-     * @param CommandInterface $command Instance of a Redis command.
+     * @param CommandInterface $command Command instance.
      * @return SingleConnectionInterface
      */
     public function getConnection(CommandInterface $command);
 
     /**
-     * Retrieves a connection instance from the aggregated connection
-     * using an alias.
+     * Returns a connection instance from the aggregate connection by its alias.
      *
-     * @param string $connectionId Alias of a connection
+     * @param string $connectionID Connection alias.
      * @return SingleConnectionInterface
      */
-    public function getConnectionById($connectionId);
+    public function getConnectionById($connectionID);
 }

+ 2 - 2
lib/Predis/Connection/ClusterConnectionInterface.php

@@ -12,8 +12,8 @@
 namespace Predis\Connection;
 
 /**
- * Defines a cluster of Redis servers formed by aggregating multiple
- * connection objects.
+ * Defines a cluster of Redis servers formed by aggregating multiple connection
+ * instances to single Redis nodes.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 5 - 6
lib/Predis/Connection/ComposableConnectionInterface.php

@@ -14,28 +14,27 @@ namespace Predis\Connection;
 use Predis\Protocol\ProtocolInterface;
 
 /**
- * Defines a connection object used to communicate with a single Redis server
- * that leverages an external protocol processor to handle pluggable protocol
- * handlers.
+ * Defines a connection to communicate with a single Redis server that leverages
+ * an external protocol processor to handle pluggable protocol handlers.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
 interface ComposableConnectionInterface extends SingleConnectionInterface
 {
     /**
-     * Gets the protocol processor used by the connection.
+     * Returns the protocol processor used by the connection.
      */
     public function getProtocol();
 
     /**
-     * Writes a buffer that contains a serialized Redis command.
+     * Writes the buffer containing a serialized command over the connection.
      *
      * @param string $buffer Serialized Redis command.
      */
     public function writeBytes($buffer);
 
     /**
-     * Reads a specified number of bytes from the connection.
+     * Reads the given number of bytes from the connection.
      *
      * @param string
      */

+ 1 - 1
lib/Predis/Connection/ComposableStreamConnection.php

@@ -26,7 +26,7 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC
     protected $protocol;
 
     /**
-     * @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
+     * @param ConnectionParametersInterface $parameters Initialization parameters for the connection.
      * @param ProtocolProcessorInterface $protocol Protocol processor.
      */
     public function __construct(

+ 3 - 4
lib/Predis/Connection/ConnectionFactory.php

@@ -16,8 +16,7 @@ use ReflectionClass;
 use Predis\Command;
 
 /**
- * Provides a default factory for Redis connections that maps URI schemes
- * to connection classes implementing Predis\Connection\SingleConnectionInterface.
+ * Standard connection factory for creating connections to Redis nodes.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -115,9 +114,9 @@ class ConnectionFactory implements ConnectionFactoryInterface
     }
 
     /**
-     * Prepares a connection object after its initialization.
+     * Prepares a connection instance after its initialization.
      *
-     * @param SingleConnectionInterface $connection Instance of a connection object.
+     * @param SingleConnectionInterface $connection Connection instance.
      */
     protected function prepareConnection(SingleConnectionInterface $connection)
     {

+ 8 - 9
lib/Predis/Connection/ConnectionFactoryInterface.php

@@ -12,8 +12,7 @@
 namespace Predis\Connection;
 
 /**
- * Interface that must be implemented by classes that provide their own mechanism
- * to create and initialize new instances of Predis\Connection\SingleConnectionInterface.
+ * Interface for classes providing a factory of connections to Redis nodes.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -22,22 +21,22 @@ interface ConnectionFactoryInterface
     /**
      * Defines or overrides the connection class identified by a scheme prefix.
      *
-     * @param string $scheme URI scheme identifying the connection class.
-     * @param mixed $initializer FQN of a connection class or a callable object for lazy initialization.
+     * @param string $scheme Target connection scheme.
+     * @param mixed $initializer Fully-qualified name of a class or a callable for lazy initialization.
      */
     public function define($scheme, $initializer);
 
     /**
      * Undefines the connection identified by a scheme prefix.
      *
-     * @param string $scheme Parameters for the connection.
+     * @param string $scheme Target connection scheme.
      */
     public function undefine($scheme);
 
     /**
      * Creates a new connection object.
      *
-     * @param mixed $parameters Parameters for the connection.
+     * @param mixed $parameters Initialization parameters for the connection.
      * @return SingleConnectionInterface
      */
     public function create($parameters);
@@ -45,8 +44,8 @@ interface ConnectionFactoryInterface
     /**
      * Aggregates single connections into an aggregate connection instance.
      *
-     * @param AggregatedConnectionInterface $cluster Instance of an aggregated connection class.
-     * @param array $parameters List of parameters for each connection object.
+     * @param AggregatedConnectionInterface $aggregate Aggregate connection instance.
+     * @param array $parameters List of parameters for each connection.
      */
-    public function aggregate(AggregatedConnectionInterface $cluster, array $parameters);
+    public function aggregate(AggregatedConnectionInterface $aggregate, array $parameters);
 }

+ 11 - 10
lib/Predis/Connection/ConnectionInterface.php

@@ -22,41 +22,42 @@ use Predis\Command\CommandInterface;
 interface ConnectionInterface
 {
     /**
-     * Opens the connection.
+     * Opens the connection to Redis.
      */
     public function connect();
 
     /**
-     * Closes the connection.
+     * Closes the connection to Redis.
      */
     public function disconnect();
 
     /**
-     * Returns if the connection is open.
+     * Checks if the connection to Redis is considered open.
      *
-     * @return Boolean
+     * @return bool
      */
     public function isConnected();
 
     /**
-     * Writes the given command over the connection.
+     * Writes the request for the given command over the connection.
      *
-     * @param CommandInterface $command Instance of a Redis command.
+     * @param CommandInterface $command Command instance.
      */
     public function writeRequest(CommandInterface $command);
 
     /**
-     * Reads the response to a command from the connection.
+     * Reads the response to the given command from the connection.
      *
-     * @param CommandInterface $command Instance of a Redis command.
+     * @param CommandInterface $command Command instance.
      * @return mixed
      */
     public function readResponse(CommandInterface $command);
 
     /**
-     * Writes a command over the connection and reads back the response.
+     * Writes a request for the given command over the connection and reads back
+     * the response returned by Redis.
      *
-     * @param CommandInterface $command Instance of a Redis command.
+     * @param CommandInterface $command Command instance.
      * @return mixed
      */
     public function executeCommand(CommandInterface $command);

+ 1 - 1
lib/Predis/Connection/ConnectionParameters.php

@@ -14,7 +14,7 @@ namespace Predis\Connection;
 use InvalidArgumentException;
 
 /**
- * Handles parsing and validation of connection parameters.
+ * Connection parameters used to initialize connections to Redis.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 8 - 4
lib/Predis/Connection/MasterSlaveReplication.php

@@ -17,8 +17,8 @@ use Predis\Command\CommandInterface;
 use Predis\Replication\ReplicationStrategy;
 
 /**
- * Aggregated connection class used by to handle replication with a
- * group of servers in a master/slave configuration.
+ * Aggregate connection handling replication of Redis nodes configured in a
+ * single master / multiple slaves setup.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -44,7 +44,9 @@ class MasterSlaveReplication implements ReplicationConnectionInterface
     protected function check()
     {
         if (!isset($this->master) || !$this->slaves) {
-            throw new RuntimeException('Replication needs a master and at least one slave.');
+            throw new RuntimeException(
+                'Replication needs a master and at least one slave.'
+            );
         }
     }
 
@@ -101,7 +103,9 @@ class MasterSlaveReplication implements ReplicationConnectionInterface
     {
         if ($this->current === null) {
             $this->check();
-            $this->current = $this->strategy->isReadOperation($command) ? $this->pickSlave() : $this->master;
+            $this->current = $this->strategy->isReadOperation($command)
+                ? $this->pickSlave()
+                : $this->master;
 
             return $this->current;
         }

+ 10 - 10
lib/Predis/Connection/PredisCluster.php

@@ -32,7 +32,7 @@ class PredisCluster implements ClusterConnectionInterface, IteratorAggregate, Co
     private $distributor;
 
     /**
-     * @param Distributor\DistributorInterface $distributor Distribution strategy used by cluster.
+     * @param Distributor\DistributorInterface $distributor Distributor instance.
      */
     public function __construct(Distributor\DistributorInterface $distributor = null)
     {
@@ -112,12 +112,12 @@ class PredisCluster implements ClusterConnectionInterface, IteratorAggregate, Co
     /**
      * Removes a connection instance using its alias or index.
      *
-     * @param string $connectionId Alias or index of a connection.
-     * @return Boolean Returns true if the connection was in the pool.
+     * @param string $connectionID Alias or index of a connection.
+     * @return bool Returns true if the connection was in the pool.
      */
-    public function removeById($connectionId)
+    public function removeById($connectionID)
     {
-        if ($connection = $this->getConnectionById($connectionId)) {
+        if ($connection = $this->getConnectionById($connectionID)) {
             return $this->remove($connection);
         }
 
@@ -145,15 +145,15 @@ class PredisCluster implements ClusterConnectionInterface, IteratorAggregate, Co
     /**
      * {@inheritdoc}
      */
-    public function getConnectionById($connectionId)
+    public function getConnectionById($connectionID)
     {
-        return isset($this->pool[$connectionId]) ? $this->pool[$connectionId] : null;
+        return isset($this->pool[$connectionID]) ? $this->pool[$connectionID] : null;
     }
 
     /**
      * Retrieves a connection instance from the cluster using a key.
      *
-     * @param string $key Key of a Redis value.
+     * @param string $key Key string.
      * @return SingleConnectionInterface
      */
     public function getConnectionByKey($key)
@@ -165,8 +165,8 @@ class PredisCluster implements ClusterConnectionInterface, IteratorAggregate, Co
     }
 
     /**
-     * Returns the underlying command hash strategy used to hash
-     * commands by their keys.
+     * Returns the underlying command hash strategy used to hash commands by
+     * using keys found in their arguments.
      *
      * @return Cluster\StrategyInterface
      */

+ 2 - 1
lib/Predis/Connection/RedisCluster.php

@@ -463,7 +463,8 @@ class RedisCluster implements ClusterConnectionInterface, IteratorAggregate, Cou
     }
 
     /**
-     * Returns the underlying hash strategy used to hash commands by their keys.
+     * Returns the underlying command hash strategy used to hash commands by
+     * using keys found in their arguments.
      *
      * @return Cluster\StrategyInterface
      */

+ 6 - 5
lib/Predis/Connection/ReplicationConnectionInterface.php

@@ -12,35 +12,36 @@
 namespace Predis\Connection;
 
 /**
- * Defines a group of Redis servers in a master/slave replication configuration.
+ * Defines a group of Redis nodes in a master / slave replication setup.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
 interface ReplicationConnectionInterface extends AggregatedConnectionInterface
 {
     /**
-     * Switches the internal connection object being used.
+     * Switches the internal connection instance in use.
      *
      * @param string $connection Alias of a connection
      */
     public function switchTo($connection);
 
     /**
-     * Retrieves the connection object currently being used.
+     * Returns the connection instance currently in use by the aggregate
+     * connection.
      *
      * @return SingleConnectionInterface
      */
     public function getCurrent();
 
     /**
-     * Retrieves the connection object to the master Redis server.
+     * Returns the connection instance for the master Redis node.
      *
      * @return SingleConnectionInterface
      */
     public function getMaster();
 
     /**
-     * Retrieves a list of connection objects to slaves Redis servers.
+     * Returns a list of connection instances to slave nodes.
      *
      * @return SingleConnectionInterface
      */

+ 5 - 5
lib/Predis/Connection/SingleConnectionInterface.php

@@ -14,7 +14,7 @@ namespace Predis\Connection;
 use Predis\Command\CommandInterface;
 
 /**
- * Defines a connection object used to communicate with a single Redis server.
+ * Defines a connection used to communicate with a single Redis node.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -28,22 +28,22 @@ interface SingleConnectionInterface extends ConnectionInterface
     public function __toString();
 
     /**
-     * Returns the underlying resource used to communicate with a Redis server.
+     * Returns the underlying resource used to communicate with Redis.
      *
      * @return mixed
      */
     public function getResource();
 
     /**
-     * Gets the parameters used to initialize the connection object.
+     * Returns the parameters used to initialize the connection.
      *
      * @return ConnectionParametersInterface
      */
     public function getParameters();
 
     /**
-     * Pushes the instance of a Redis command to the queue of commands executed
-     * when the actual connection to a server is estabilished.
+     * Pushes the given command into a queue of commands executed when
+     * establishing the actual connection to Redis.
      *
      * @param CommandInterface $command Instance of a Redis command.
      */

+ 7 - 7
lib/Predis/Connection/StreamConnection.php

@@ -32,9 +32,9 @@ use Predis\Response;
 class StreamConnection extends AbstractConnection
 {
     /**
-     * Disconnects from the server and destroys the underlying resource when
-     * PHP's garbage collector kicks in only if the connection has not been
-     * marked as persistent.
+     * Disconnects from the server and destroys the underlying resource when the
+     * garbage collector kicks in only if the connection has not been marked as
+     * persistent.
      */
     public function __destruct()
     {
@@ -59,7 +59,7 @@ class StreamConnection extends AbstractConnection
     /**
      * Initializes a TCP stream resource.
      *
-     * @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
+     * @param ConnectionParametersInterface $parameters Initialization parameters for the connection.
      * @return resource
      */
     private function tcpStreamInitializer(ConnectionParametersInterface $parameters)
@@ -99,7 +99,7 @@ class StreamConnection extends AbstractConnection
     /**
      * Initializes a UNIX stream resource.
      *
-     * @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
+     * @param ConnectionParametersInterface $parameters Initialization parameters for the connection.
      * @return resource
      */
     private function unixStreamInitializer(ConnectionParametersInterface $parameters)
@@ -146,10 +146,10 @@ class StreamConnection extends AbstractConnection
     }
 
     /**
-     * Performs a write operation on the stream of the buffer containing a
+     * Performs a write operation over the stream of the buffer containing a
      * command serialized with the Redis wire protocol.
      *
-     * @param string $buffer Redis wire protocol representation of a command.
+     * @param string $buffer Representation of a command in the Redis wire protocol.
      */
     protected function writeBytes($buffer)
     {

+ 9 - 9
lib/Predis/Connection/WebdisConnection.php

@@ -50,7 +50,7 @@ class WebdisConnection implements SingleConnectionInterface
     private $reader;
 
     /**
-     * @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
+     * @param ConnectionParametersInterface $parameters Initialization parameters for the connection.
      */
     public function __construct(ConnectionParametersInterface $parameters)
     {
@@ -66,8 +66,8 @@ class WebdisConnection implements SingleConnectionInterface
     }
 
     /**
-     * Frees the underlying cURL and protocol reader resources when PHP's
-     * garbage collector kicks in.
+     * Frees the underlying cURL and protocol reader resources when the garbage
+     * collector kicks in.
      */
     public function __destruct()
     {
@@ -105,7 +105,7 @@ class WebdisConnection implements SingleConnectionInterface
     /**
      * Initializes cURL.
      *
-     * @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
+     * @param ConnectionParametersInterface $parameters Initialization parameters for the connection.
      * @return resource
      */
     private function createCurl(ConnectionParametersInterface $parameters)
@@ -129,9 +129,9 @@ class WebdisConnection implements SingleConnectionInterface
     }
 
     /**
-     * Initializes phpiredis' protocol reader.
+     * Initializes the phpiredis protocol reader.
      *
-     * @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
+     * @param ConnectionParametersInterface $parameters Initialization parameters for the connection.
      * @return resource
      */
     private function createReader(ConnectionParametersInterface $parameters)
@@ -169,10 +169,10 @@ class WebdisConnection implements SingleConnectionInterface
     }
 
     /**
-     * Feeds phpredis' reader resource with the data read from the network.
+     * Feeds the phpredis reader resource with the data read from the network.
      *
      * @param resource $resource Reader resource.
-     * @param string $buffer Data read from the network.
+     * @param string $buffer Buffer of data read from a connection.
      * @return int
      */
     protected function feedReader($resource, $buffer)
@@ -209,7 +209,7 @@ class WebdisConnection implements SingleConnectionInterface
     /**
      * Checks if the specified command is supported by this connection class.
      *
-     * @param CommandInterface $command The instance of a Redis command.
+     * @param CommandInterface $command Command instance.
      * @return string
      */
     protected function getCommandId(CommandInterface $command)

+ 2 - 2
lib/Predis/ExecutableContextInterface.php

@@ -12,8 +12,8 @@
 namespace Predis;
 
 /**
- * Defines the interface of a basic client object or abstraction that
- * can send commands to Redis.
+ * Defines the interface of a basic client object or abstraction that can send
+ * commands to Redis.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 5 - 5
lib/Predis/Monitor/Consumer.php

@@ -32,14 +32,14 @@ class Consumer implements Iterator
      */
     public function __construct(ClientInterface $client)
     {
-        $this->checkCapabilities($client);
+        $this->assertClient($client);
         $this->client = $client;
 
         $this->start();
     }
 
     /**
-     * Automatically stops the consumer when PHP's garbage collector kicks in.
+     * Automatically stops the consumer when the garbage collector kicks in.
      */
     public function __destruct()
     {
@@ -52,7 +52,7 @@ class Consumer implements Iterator
      *
      * @param ClientInterface $client Client instance used by the consumer.
      */
-    private function checkCapabilities(ClientInterface $client)
+    private function assertClient(ClientInterface $client)
     {
         if ($client->getConnection() instanceof AggregatedConnectionInterface) {
             throw new NotSupportedException(
@@ -132,8 +132,8 @@ class Consumer implements Iterator
     }
 
     /**
-     * Waits for a new message from the server generated by MONITOR and
-     * returns it when available.
+     * Waits for a new message from the server generated by MONITOR and returns
+     * it when available.
      *
      * @return Object
      */

+ 2 - 2
lib/Predis/NotSupportedException.php

@@ -12,8 +12,8 @@
 namespace Predis;
 
 /**
- * Exception class generated when trying to use features not
- * supported by certain classes or abstractions.
+ * Exception class thrown when trying to use features not supported by certain
+ * classes or abstractions of Predis.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 6 - 6
lib/Predis/Pipeline/Pipeline.php

@@ -64,7 +64,7 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface
     /**
      * Queues a command instance into the pipeline buffer.
      *
-     * @param CommandInterface $command Command to queue in the buffer.
+     * @param CommandInterface $command Command to be queued in the buffer.
      */
     protected function recordCommand(CommandInterface $command)
     {
@@ -74,7 +74,7 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface
     /**
      * Queues a command instance into the pipeline buffer.
      *
-     * @param CommandInterface $command Command to queue in the buffer.
+     * @param CommandInterface $command Command to be queued in the buffer.
      */
     public function executeCommand(CommandInterface $command)
     {
@@ -82,10 +82,10 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface
     }
 
     /**
-     * Throws and exception on -ERR responses returned by Redis.
+     * Throws an exception on -ERR responses returned by Redis.
      *
-     * @param ConnectionInterface $connection The connection that returned the error.
-     * @param Response\ErrorInterface $response The error response instance.
+     * @param ConnectionInterface $connection Redis connection that returned the error.
+     * @param Response\ErrorInterface $response Instance of the error response.
      */
     protected function exception(ConnectionInterface $connection, Response\ErrorInterface $response)
     {
@@ -145,7 +145,7 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface
     }
 
     /**
-     * Flushes the buffer that holds the queued commands.
+     * Flushes the buffer holding all of the commands queued so far.
      *
      * @param bool $send Specifies if the commands in the buffer should be sent to Redis.
      * @return Pipeline

+ 4 - 2
lib/Predis/Profile/Factory.php

@@ -16,7 +16,7 @@ use ReflectionClass;
 use Predis\ClientException;
 
 /**
- * Base class that implements common functionalities of server profiles.
+ * Factory class for creating profile instances from strings.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -72,7 +72,9 @@ final class Factory
         $reflection = new ReflectionClass($profileClass);
 
         if (!$reflection->isSubclassOf('Predis\Profile\ProfileInterface')) {
-            throw new InvalidArgumentException("Cannot register '$profileClass' as it is not a valid profile class");
+            throw new InvalidArgumentException(
+                "Cannot register '$profileClass' as it is not a valid profile class"
+            );
         }
 
         self::$profiles[$alias] = $profileClass;

+ 5 - 5
lib/Predis/Profile/RedisProfile.php

@@ -17,7 +17,7 @@ use Predis\ClientException;
 use Predis\Command\Processor\CommandProcessorInterface;
 
 /**
- * Base class that implements common functionalities of server profiles.
+ * Base class implementing common functionalities for Redis server profiles.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -65,8 +65,8 @@ abstract class RedisProfile implements ProfileInterface
     }
 
     /**
-     * Returns the FQN of the class that represent the specified command ID
-     * registered in the current server profile.
+     * Returns the fully-qualified name of a class representing the specified
+     * command ID registered in the current server profile.
      *
      * @param string $commandID Command ID.
      * @return string
@@ -101,10 +101,10 @@ abstract class RedisProfile implements ProfileInterface
     }
 
     /**
-     * Defines a new commands in the server profile.
+     * Defines a new command in the server profile.
      *
      * @param string $commandID Command ID.
-     * @param string $commandClass FQN of a class implementing Predis\Command\CommandInterface.
+     * @param string $commandClass Fully-qualified name of a Predis\Command\CommandInterface.
      */
     public function defineCommand($commandID, $commandClass)
     {

+ 1 - 1
lib/Predis/Profile/RedisVersion120.php

@@ -12,7 +12,7 @@
 namespace Predis\Profile;
 
 /**
- * Server profile for Redis v1.2.x.
+ * Server profile for Redis 1.2.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 1 - 1
lib/Predis/Profile/RedisVersion200.php

@@ -12,7 +12,7 @@
 namespace Predis\Profile;
 
 /**
- * Server profile for Redis v2.0.x.
+ * Server profile for Redis 2.0.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 1 - 1
lib/Predis/Profile/RedisVersion220.php

@@ -12,7 +12,7 @@
 namespace Predis\Profile;
 
 /**
- * Server profile for Redis v2.2.x.
+ * Server profile for Redis 2.2.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 1 - 1
lib/Predis/Profile/RedisVersion240.php

@@ -12,7 +12,7 @@
 namespace Predis\Profile;
 
 /**
- * Server profile for Redis v2.4.x.
+ * Server profile for Redis 2.4.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 1 - 1
lib/Predis/Profile/RedisVersion260.php

@@ -12,7 +12,7 @@
 namespace Predis\Profile;
 
 /**
- * Server profile for Redis v2.6.x.
+ * Server profile for Redis 2.6.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 1 - 1
lib/Predis/Profile/RedisVersion280.php

@@ -12,7 +12,7 @@
 namespace Predis\Profile;
 
 /**
- * Server profile for Redis v2.8.x.
+ * Server profile for Redis 2.8.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 2 - 1
lib/Predis/Protocol/ProtocolException.php

@@ -14,7 +14,8 @@ namespace Predis\Protocol;
 use Predis\CommunicationException;
 
 /**
- * Errors encountered while handling the wire protocol.
+ * Exception used to indentify errors encountered while parsing the Redis wire
+ * protocol.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 5 - 5
lib/Predis/Protocol/ProtocolProcessorInterface.php

@@ -23,17 +23,17 @@ use Predis\Connection\ComposableConnectionInterface;
 interface ProtocolProcessorInterface
 {
     /**
-     * Writes a command to the specified connection.
+     * Writes a request over a connection to Redis.
      *
-     * @param ComposableConnectionInterface $connection Connection to Redis.
-     * @param CommandInterface $command Redis command.
+     * @param ComposableConnectionInterface $connection Redis connection.
+     * @param CommandInterface $command Command instance.
      */
     public function write(ComposableConnectionInterface $connection, CommandInterface $command);
 
     /**
-     * Reads a response from the specified connection.
+     * Reads a response from a connection to Redis.
      *
-     * @param ComposableConnectionInterface $connection Connection to Redis.
+     * @param ComposableConnectionInterface $connection Redis connection.
      * @return mixed
      */
     public function read(ComposableConnectionInterface $connection);

+ 2 - 2
lib/Predis/Protocol/ResponseReaderInterface.php

@@ -22,9 +22,9 @@ use Predis\Connection\ComposableConnectionInterface;
 interface ResponseReaderInterface
 {
     /**
-     * Reads a response from the connection.
+     * Reads a response from a connection to Redis.
      *
-     * @param ComposableConnectionInterface $connection Connection to Redis.
+     * @param ComposableConnectionInterface $connection Redis connection.
      * @return mixed
      */
     public function read(ComposableConnectionInterface $connection);

+ 4 - 4
lib/Predis/Protocol/Text/Handler/ResponseHandlerInterface.php

@@ -21,11 +21,11 @@ use Predis\Connection\ComposableConnectionInterface;
 interface ResponseHandlerInterface
 {
     /**
-     * Deserializes the response returned by Redis and reads more data from the
-     * connection when needed.
+     * Deserializes a response returned by Redis and reads more data from the
+     * connection if needed.
      *
-     * @param ComposableConnectionInterface $connection Connection to Redis.
-     * @param string $payload Raw payload.
+     * @param ComposableConnectionInterface $connection Redis connection.
+     * @param string $payload String payload.
      * @return mixed
      */
     function handle(ComposableConnectionInterface $connection, $payload);

+ 3 - 3
lib/Predis/Protocol/Text/Handler/StatusResponse.php

@@ -15,9 +15,9 @@ use Predis\Connection\ComposableConnectionInterface;
 use Predis\Response;
 
 /**
- * Handler for the status response type in the standard Redis wire protocol.
- * It translates certain classes of status response to PHP objects or just
- * returns the payload as a string.
+ * Handler for the status response type in the standard Redis wire protocol. It
+ * translates certain classes of status response to PHP objects or just returns
+ * the payload as a string.
  *
  * @link http://redis.io/topics/protocol
  * @author Daniele Alessandri <suppakilla@gmail.com>

+ 2 - 2
lib/Predis/Protocol/Text/ProtocolProcessor.php

@@ -105,8 +105,8 @@ class ProtocolProcessor implements ProtocolProcessorInterface
      * returning a plain array.
      *
      * Streamable multibulk responses are not globally supported by the
-     * abstractions built-in into Predis, such as transactions or pipelines. Use
-     * them with care!
+     * abstractions built-in into Predis, such as transactions or pipelines.
+     * Use them with care!
      *
      * @param bool $value Enable or disable streamable multibulk responses.
      */

+ 2 - 2
lib/Predis/Protocol/Text/ResponseReader.php

@@ -97,10 +97,10 @@ class ResponseReader implements ResponseReaderInterface
     }
 
     /**
-     * Handles protocol errors generated while reading responses from the
+     * Handles protocol errors generated while reading responses from a
      * connection.
      *
-     * @param ComposableConnectionInterface $connection Connection to Redis that generated the error.
+     * @param ComposableConnectionInterface $connection Redis connection that generated the error.
      * @param string $message Error message.
      */
     protected function onProtocolError(ComposableConnectionInterface $connection, $message)

+ 9 - 10
lib/Predis/PubSub/AbstractConsumer.php

@@ -14,7 +14,7 @@ namespace Predis\PubSub;
 use Iterator;
 
 /**
- * Base implementation of a PUB/SUB consumer abstraction.
+ * Base implementation of a PUB/SUB consumer abstraction based on PHP iterators.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -35,7 +35,7 @@ abstract class AbstractConsumer implements Iterator
     private $statusFlags = self::STATUS_VALID;
 
     /**
-     * Automatically stops the consumer when PHP's garbage collector kicks in.
+     * Automatically stops the consumer when the garbage collector kicks in.
      */
     public function __destruct()
     {
@@ -96,12 +96,11 @@ abstract class AbstractConsumer implements Iterator
     }
 
     /**
-     * Closes the context by unsubscribing from all the subscribed channels.
-     * Optionally, the context can be forcefully closed by dropping the
-     * underlying connection.
+     * Closes the context by unsubscribing from all the subscribed channels. The
+     * context can be forcefully closed by dropping the underlying connection.
      *
-     * @param bool $drop Forcefully close the context by closing the connection.
-     * @return bool Returns false if there are no pending messages.
+     * @param bool $drop Indicates if the context should be closed by dropping the connection.
+     * @return bool Returns false when there are no pending messages.
      */
     public function stop($drop = false)
     {
@@ -125,15 +124,15 @@ abstract class AbstractConsumer implements Iterator
     }
 
     /**
-     * Closes the underlying connection on forced disconnection.
+     * Closes the underlying connection when forcing a disconnection.
      */
     protected abstract function disconnect();
 
     /**
      * Writes a Redis command on the underlying connection.
      *
-     * @param string $method ID of the command.
-     * @param array $arguments List of arguments.
+     * @param string $method Command ID.
+     * @param array $arguments Arguments for the command.
      */
     protected abstract function writeRequest($method, $arguments);
 

+ 2 - 2
lib/Predis/PubSub/Consumer.php

@@ -52,8 +52,8 @@ class Consumer extends AbstractConsumer
     }
 
     /**
-     * Checks if the passed client instance satisfies the required conditions
-     * needed to initialize a PUB/SUB consumer.
+     * Checks if the client instance satisfies the required conditions needed to
+     * initialize a PUB/SUB consumer.
      *
      * @param ClientInterface $client Client instance used by the consumer.
      */

+ 7 - 7
lib/Predis/PubSub/DispatcherLoop.php

@@ -16,7 +16,7 @@ use Predis\ClientInterface;
 
 /**
  * Method-dispatcher loop built around the client-side abstraction of a Redis
- * Publish / Subscribe context.
+ * PUB / SUB context.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -42,7 +42,7 @@ class DispatcherLoop
      *
      * @param mixed $callable A callback.
      */
-    protected function validateCallback($callable)
+    protected function assertCallback($callable)
     {
         if (!is_callable($callable)) {
             throw new InvalidArgumentException("A valid callable object must be provided");
@@ -50,7 +50,7 @@ class DispatcherLoop
     }
 
     /**
-     * Returns the underlying Publish / Subscribe context.
+     * Returns the underlying PUB / SUB context.
      *
      * @return Consumer
      */
@@ -67,7 +67,7 @@ class DispatcherLoop
     public function subscriptionCallback($callable = null)
     {
         if (isset($callable)) {
-            $this->validateCallback($callable);
+            $this->assertCallback($callable);
         }
 
         $this->subscriptionCallback = $callable;
@@ -82,7 +82,7 @@ class DispatcherLoop
     public function defaultCallback($callable = null)
     {
         if (isset($callable)) {
-            $this->validateCallback($callable);
+            $this->assertCallback($callable);
         }
 
         $this->subscriptionCallback = $callable;
@@ -98,7 +98,7 @@ class DispatcherLoop
     {
         $callbackName = $this->getPrefixKeys() . $channel;
 
-        $this->validateCallback($callback);
+        $this->assertCallback($callback);
         $this->callbacks[$callbackName] = $callback;
         $this->pubsub->subscribe($channel);
     }
@@ -154,7 +154,7 @@ class DispatcherLoop
     }
 
     /**
-     * Return the prefix of the keys
+     * Return the prefix used for keys
      *
      * @return string
      */

+ 21 - 18
lib/Predis/Replication/ReplicationStrategy.php

@@ -36,16 +36,18 @@ class ReplicationStrategy
     }
 
     /**
-     * Returns if the specified command performs a read-only operation
-     * against a key stored on Redis.
+     * Returns if the specified command will perform a read-only operation
+     * on Redis or not.
      *
-     * @param CommandInterface $command Instance of Redis command.
-     * @return Boolean
+     * @param CommandInterface $command Command instance.
+     * @return bool
      */
     public function isReadOperation(CommandInterface $command)
     {
         if (isset($this->disallowed[$id = $command->getId()])) {
-            throw new NotSupportedException("The command $id is not allowed in replication mode");
+            throw new NotSupportedException(
+                "The command $id is not allowed in replication mode"
+            );
         }
 
         if (isset($this->readonly[$id])) {
@@ -72,11 +74,11 @@ class ReplicationStrategy
     }
 
     /**
-     * Returns if the specified command is disallowed in a master/slave
-     * replication context.
+     * Returns if the specified command is not allowed for execution in a master
+     * / slave replication context.
      *
-     * @param CommandInterface $command Instance of Redis command.
-     * @return Boolean
+     * @param CommandInterface $command Command instance.
+     * @return bool
      */
     public function isDisallowedOperation(CommandInterface $command)
     {
@@ -87,8 +89,8 @@ class ReplicationStrategy
      * Checks if a SORT command is a readable operation by parsing the arguments
      * array of the specified commad instance.
      *
-     * @param CommandInterface $command Instance of Redis command.
-     * @return Boolean
+     * @param CommandInterface $command Command instance.
+     * @return bool
      */
     protected function isSortReadOnly(CommandInterface $command)
     {
@@ -97,13 +99,14 @@ class ReplicationStrategy
     }
 
     /**
-     * Marks a command as a read-only operation. When the behaviour of a
-     * command can be decided only at runtime depending on its arguments,
-     * a callable object can be provided to dynamically check if the passed
-     * instance of a command performs write operations or not.
+     * Marks a command as a read-only operation.
      *
-     * @param string $commandID ID of the command.
-     * @param mixed $readonly A boolean or a callable object.
+     * When the behavior of a command can be decided only at runtime depending
+     * on its arguments, a callable object can be provided to dynamically check
+     * if the specified command performs a read or a write operation.
+     *
+     * @param string $commandID Command ID.
+     * @param mixed $readonly A boolean value or a callable object.
      */
     public function setCommandReadOnly($commandID, $readonly = true)
     {
@@ -124,7 +127,7 @@ class ReplicationStrategy
      * not.
      *
      * @param string $script Body of the Lua script.
-     * @param mixed $readonly A boolean or a callable object.
+     * @param mixed $readonly A boolean value or a callable object.
      */
     public function setScriptReadOnly($script, $readonly = true)
     {

+ 3 - 3
lib/Predis/Response/Iterator/MultiBulk.php

@@ -35,9 +35,9 @@ class MultiBulk extends MultiBulkIterator
     }
 
     /**
-     * Handles the synchronization of the client with the Redis protocol
-     * then PHP's garbage collector kicks in (e.g. then the iterator goes
-     * out of the scope of a foreach).
+     * Handles the synchronization of the client with the Redis protocol when
+     * the garbage collector kicks in (e.g. when the iterator goes out of the
+     * scope of a foreach or it is unset).
      */
     public function __destruct()
     {

+ 6 - 2
lib/Predis/Response/Iterator/MultiBulkTuple.php

@@ -49,11 +49,15 @@ class MultiBulkTuple extends MultiBulk implements OuterIterator
     protected function checkPreconditions(MultiBulk $iterator)
     {
         if ($iterator->getPosition() !== 0) {
-            throw new RuntimeException('Cannot initialize a tuple iterator with an already initiated iterator');
+            throw new RuntimeException(
+                'Cannot initialize a tuple iterator with an already initiated iterator'
+            );
         }
 
         if (($size = count($iterator)) % 2 !== 0) {
-            throw new UnexpectedValueException("Invalid response size for a tuple iterator [$size]");
+            throw new UnexpectedValueException(
+                "Invalid response size for a tuple iterator [$size]"
+            );
         }
     }
 

+ 3 - 3
lib/Predis/Response/Status.php

@@ -52,10 +52,10 @@ class Status implements ResponseInterface
     }
 
     /**
-     * Returns a new instance of a status response object.
+     * Returns an instance of a status response object.
      *
-     * Common status responses such as OK or QUEUED are cached to lower the
-     * memory usage especially when using pipelines.
+     * Common status responses such as OK or QUEUED are cached in order to lower
+     * the global memory usage especially when using pipelines.
      *
      * @return string
      */

+ 10 - 5
lib/Predis/Session/Handler.php

@@ -18,9 +18,9 @@ use Predis\ClientInterface;
  * Session handler class that relies on Predis\Client to store PHP's sessions
  * data into one or multiple Redis servers.
  *
- * This class is mostly intended for PHP 5.4 but it can be used under PHP 5.3 provided
- * that a polyfill for `SessionHandlerInterface` is defined by either you or an external
- * package such as `symfony/http-foundation`.
+ * This class is mostly intended for PHP 5.4 but it can be used under PHP 5.3
+ * provided that a polyfill for `SessionHandlerInterface` is defined by either
+ * you or an external package such as `symfony/http-foundation`.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
@@ -36,11 +36,16 @@ class Handler implements SessionHandlerInterface
     public function __construct(ClientInterface $client, array $options = array())
     {
         $this->client = $client;
-        $this->ttl = (int) (isset($options['gc_maxlifetime']) ? $options['gc_maxlifetime'] : ini_get('session.gc_maxlifetime'));
+
+        if (isset($options['gc_maxlifetime'])) {
+            $this->ttl = (int) $options['gc_maxlifetime'];
+        } else {
+            $this->ttl = ini_get('session.gc_maxlifetime');
+        }
     }
 
     /**
-     * Registers the handler instance as the current session handler.
+     * Registers this instance as the current session handler.
      */
     public function register()
     {

+ 1 - 1
lib/Predis/Transaction/AbortedMultiExecException.php

@@ -14,7 +14,7 @@ namespace Predis\Transaction;
 use Predis\PredisException;
 
 /**
- * Exception class that identifies MULTI / EXEC transactions aborted by Redis.
+ * Exception class that identifies a MULTI / EXEC transaction aborted by Redis.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 11 - 11
lib/Predis/Transaction/MultiExec.php

@@ -104,7 +104,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     }
 
     /**
-     * Resets the state of a transaction.
+     * Resets the state of the transaction.
      */
     protected function reset()
     {
@@ -113,7 +113,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     }
 
     /**
-     * Initializes a new transaction.
+     * Initializes the transaction context.
      */
     protected function initialize()
     {
@@ -160,7 +160,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     }
 
     /**
-     * Sends a Redis command bypassing the transaction logic.
+     * Executes a Redis command bypassing the transaction logic.
      *
      * @param string $method Command ID.
      * @param array $arguments Arguments for the command.
@@ -181,7 +181,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     /**
      * Executes the specified Redis command.
      *
-     * @param CommandInterface $command A Redis command.
+     * @param CommandInterface $command Command instance.
      * @return mixed
      */
     public function executeCommand(CommandInterface $command)
@@ -203,7 +203,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     }
 
     /**
-     * Executes WATCH on one or more keys.
+     * Executes WATCH against one or more keys.
      *
      * @param string|array $keys One or more keys.
      * @return mixed
@@ -226,7 +226,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     }
 
     /**
-     * Finalizes the transaction on the server by executing MULTI on the server.
+     * Finalizes the transaction by executing MULTI on the server.
      *
      * @return MultiExec
      */
@@ -260,8 +260,8 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     }
 
     /**
-     * Resets a transaction by UNWATCHing the keys that are being WATCHed and
-     * DISCARDing the pending commands that have been already sent to the server.
+     * Resets the transaction by UNWATCH-ing the keys that are being WATCHed and
+     * DISCARD-ing pending commands that have been already sent to the server.
      *
      * @return MultiExec
      */
@@ -413,15 +413,15 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     }
 
     /**
-     * Helper method that handles protocol errors encountered inside a transaction.
+     * Helper method for protocol errors encountered inside the transaction.
      *
      * @param string $message Error message.
      */
     private function onProtocolError($message)
     {
         // Since a MULTI/EXEC block cannot be initialized when using aggregated
-        // connections, we can safely assume that Predis\Client::getConnection()
-        // will always return an instance of Predis\Connection\SingleConnectionInterface.
+        // connections we can safely assume that Predis\Client::getConnection()
+        // will return a Predis\Connection\SingleConnectionInterface instance.
         CommunicationException::handle(new ProtocolException(
             $this->client->getConnection(), $message
         ));