Browse Source

Rename certain namespaces, interfaces and classes.

Now we follow a Symfony2-like naming convention for namespaces, interfaces
and classes sticking with one clear rule.

- Renamed namespaces:

  - Predis\Network
  - Predis\Profiles
  - Predis\Iterators
  - Predis\Options
  - Predis\Commands
  - Predis\Commands\Processors

- Renamed interfaces:

  - Predis\IReplyObject
  - Predis\IRedisServerError
  - Predis\IConnectionFactory
  - Predis\IConnectionParameters
  - Predis\Options\IOption
  - Predis\Options\IClientOptions
  - Predis\Profile\IServerProfile
  - Predis\Pipeline\IPipelineExecutor
  - Predis\Distribution\INodeKeyGenerator
  - Predis\Distribution\IDistributionStrategy
  - Predis\Protocol\IProtocolProcessor
  - Predis\Protocol\IResponseReader
  - Predis\Protocol\IResponseHandler
  - Predis\Protocol\ICommandSerializer
  - Predis\Protocol\IComposableProtocolProcessor
  - Predis\Network\IConnection
  - Predis\Network\IConnectionSingle
  - Predis\Network\IConnectionComposable
  - Predis\Network\IConnectionCluster
  - Predis\Network\IConnectionReplication
  - Predis\Commands\ICommand
  - Predis\Commands\IPrefixable
  - Predis\Command\Processor\ICommandProcessor
  - Predis\Command\Processor\ICommandProcessorChain
  - Predis\Command\Processor\IProcessingSupport

- Renamed Classes:

  - Predis\Commands\Command
  - Predis\Network\ConnectionBase

- Classes moved to different namespaces:

  - Predis\MonitorContext

Meh
Daniele Alessandri 13 years ago
parent
commit
dc14c29676
100 changed files with 292 additions and 227 deletions
  1. 67 0
      CHANGELOG.md
  2. 1 1
      FAQ.PERFORMANCES.md
  3. 5 5
      README.md
  4. 11 11
      bin/generate-command-test.php
  5. 5 5
      examples/CustomDistributionStrategy.php
  6. 4 4
      examples/MasterSlaveReplicationComplex.php
  7. 2 2
      examples/ServerSideScripting.php
  8. 5 5
      examples/SimpleDebuggableConnection.php
  9. 23 23
      lib/Predis/Client.php
  10. 5 5
      lib/Predis/Command/AbstractCommand.php
  11. 5 5
      lib/Predis/Command/CommandInterface.php
  12. 2 2
      lib/Predis/Command/ConnectionAuth.php
  13. 2 2
      lib/Predis/Command/ConnectionEcho.php
  14. 2 2
      lib/Predis/Command/ConnectionPing.php
  15. 2 2
      lib/Predis/Command/ConnectionQuit.php
  16. 2 2
      lib/Predis/Command/ConnectionSelect.php
  17. 1 1
      lib/Predis/Command/HashDelete.php
  18. 1 1
      lib/Predis/Command/HashExists.php
  19. 1 1
      lib/Predis/Command/HashGet.php
  20. 2 2
      lib/Predis/Command/HashGetAll.php
  21. 1 1
      lib/Predis/Command/HashGetMultiple.php
  22. 1 1
      lib/Predis/Command/HashIncrementBy.php
  23. 1 1
      lib/Predis/Command/HashIncrementByFloat.php
  24. 1 1
      lib/Predis/Command/HashKeys.php
  25. 1 1
      lib/Predis/Command/HashLength.php
  26. 1 1
      lib/Predis/Command/HashSet.php
  27. 1 1
      lib/Predis/Command/HashSetMultiple.php
  28. 1 1
      lib/Predis/Command/HashSetPreserve.php
  29. 1 1
      lib/Predis/Command/HashValues.php
  30. 2 2
      lib/Predis/Command/KeyDelete.php
  31. 1 1
      lib/Predis/Command/KeyExists.php
  32. 1 1
      lib/Predis/Command/KeyExpire.php
  33. 1 1
      lib/Predis/Command/KeyExpireAt.php
  34. 1 1
      lib/Predis/Command/KeyKeys.php
  35. 1 1
      lib/Predis/Command/KeyKeysV12x.php
  36. 1 1
      lib/Predis/Command/KeyMove.php
  37. 1 1
      lib/Predis/Command/KeyPersist.php
  38. 1 1
      lib/Predis/Command/KeyPreciseExpire.php
  39. 1 1
      lib/Predis/Command/KeyPreciseExpireAt.php
  40. 1 1
      lib/Predis/Command/KeyPreciseTimeToLive.php
  41. 2 2
      lib/Predis/Command/KeyRandom.php
  42. 2 2
      lib/Predis/Command/KeyRename.php
  43. 1 1
      lib/Predis/Command/KeyRenamePreserve.php
  44. 2 2
      lib/Predis/Command/KeySort.php
  45. 1 1
      lib/Predis/Command/KeyTimeToLive.php
  46. 1 1
      lib/Predis/Command/KeyType.php
  47. 1 1
      lib/Predis/Command/ListIndex.php
  48. 1 1
      lib/Predis/Command/ListInsert.php
  49. 1 1
      lib/Predis/Command/ListLength.php
  50. 1 1
      lib/Predis/Command/ListPopFirst.php
  51. 2 2
      lib/Predis/Command/ListPopFirstBlocking.php
  52. 1 1
      lib/Predis/Command/ListPopLast.php
  53. 1 1
      lib/Predis/Command/ListPopLastBlocking.php
  54. 2 2
      lib/Predis/Command/ListPopLastPushHead.php
  55. 2 2
      lib/Predis/Command/ListPopLastPushHeadBlocking.php
  56. 1 1
      lib/Predis/Command/ListPushHead.php
  57. 1 1
      lib/Predis/Command/ListPushHeadX.php
  58. 1 1
      lib/Predis/Command/ListPushTail.php
  59. 1 1
      lib/Predis/Command/ListPushTailX.php
  60. 1 1
      lib/Predis/Command/ListRange.php
  61. 1 1
      lib/Predis/Command/ListRemove.php
  62. 1 1
      lib/Predis/Command/ListSet.php
  63. 1 1
      lib/Predis/Command/ListTrim.php
  64. 9 9
      lib/Predis/Command/PrefixHelpers.php
  65. 2 2
      lib/Predis/Command/PrefixableCommand.php
  66. 2 4
      lib/Predis/Command/PrefixableCommandInterface.php
  67. 5 5
      lib/Predis/Command/Processor/CommandProcessingInterface.php
  68. 6 6
      lib/Predis/Command/Processor/CommandProcessorChainInterface.php
  69. 5 5
      lib/Predis/Command/Processor/CommandProcessorInterface.php
  70. 6 6
      lib/Predis/Command/Processor/KeyPrefixProcessor.php
  71. 9 9
      lib/Predis/Command/Processor/ProcessorChain.php
  72. 1 1
      lib/Predis/Command/PubSubPublish.php
  73. 2 2
      lib/Predis/Command/PubSubSubscribe.php
  74. 1 1
      lib/Predis/Command/PubSubSubscribeByPattern.php
  75. 2 2
      lib/Predis/Command/PubSubUnsubscribe.php
  76. 1 1
      lib/Predis/Command/PubSubUnsubscribeByPattern.php
  77. 1 1
      lib/Predis/Command/ScriptedCommand.php
  78. 2 2
      lib/Predis/Command/ServerBackgroundRewriteAOF.php
  79. 2 2
      lib/Predis/Command/ServerBackgroundSave.php
  80. 2 2
      lib/Predis/Command/ServerClient.php
  81. 3 3
      lib/Predis/Command/ServerConfig.php
  82. 2 2
      lib/Predis/Command/ServerDatabaseSize.php
  83. 2 2
      lib/Predis/Command/ServerEval.php
  84. 1 1
      lib/Predis/Command/ServerEvalSHA.php
  85. 2 2
      lib/Predis/Command/ServerFlushAll.php
  86. 2 2
      lib/Predis/Command/ServerFlushDatabase.php
  87. 2 2
      lib/Predis/Command/ServerInfo.php
  88. 1 1
      lib/Predis/Command/ServerInfoV26x.php
  89. 2 2
      lib/Predis/Command/ServerLastSave.php
  90. 2 2
      lib/Predis/Command/ServerMonitor.php
  91. 2 2
      lib/Predis/Command/ServerObject.php
  92. 2 2
      lib/Predis/Command/ServerSave.php
  93. 2 2
      lib/Predis/Command/ServerScript.php
  94. 2 2
      lib/Predis/Command/ServerShutdown.php
  95. 2 2
      lib/Predis/Command/ServerSlaveOf.php
  96. 3 3
      lib/Predis/Command/ServerSlowlog.php
  97. 1 1
      lib/Predis/Command/SetAdd.php
  98. 1 1
      lib/Predis/Command/SetCardinality.php
  99. 1 1
      lib/Predis/Command/SetDifference.php
  100. 1 1
      lib/Predis/Command/SetDifferenceStore.php

+ 67 - 0
CHANGELOG.md

@@ -1,3 +1,70 @@
+v0.8.0 (201x-xx-xx)
+===============================================================================
+
+- Some namespaces have been renamed:
+
+  - `Predis\Network` => `Predis\Connection`
+  - `Predis\Profiles` => `Predis\Profile`
+  - `Predis\Iterators` => `Predis\Iterator`
+  - `Predis\Options` => `Predis\Option`
+  - `Predis\Commands` => `Predis\Command`
+  - `Predis\Commands\Processors` => `Predis\Command\Processor`
+
+- Some interfaces have been renamed:
+
+  - `Predis\IReplyObject` => `Predis\ResponseObjectInterface`
+  - `Predis\IRedisServerError` => `Predis\ResponseErrorInterface`
+  - `Predis\IConnectionFactory` => `Predis\ConnectionFactoryInterface`
+  - `Predis\IConnectionParameters` => `Predis\ConnectionParametersInterface`
+  - `Predis\Options\IOption` => `Predis\Option\OptionInterface`
+  - `Predis\Options\IClientOptions` => `Predis\Option\ClientOptionsInterface`
+  - `Predis\Profile\IServerProfile` => `Predis\Profile\ServerProfileInterface`
+  - `Predis\Pipeline\IPipelineExecutor`
+      => `Predis\Pipeline\PipelineExecutorInterface`
+  - `Predis\Distribution\INodeKeyGenerator`
+      => `Predis\Distribution\HashGeneratorInterface`
+  - `Predis\Distribution\IDistributionStrategy`
+      => `Predis\Distribution\DistributionStrategyInterface`
+  - `Predis\Protocol\IProtocolProcessor` => `Predis\Protocol\ProtocolInterface`
+  - `Predis\Protocol\IResponseReader`
+      => `Predis\Protocol\ResponseReaderInterface`
+  - `Predis\Protocol\IResponseHandler`
+      => `Predis\Protocol\ResponseHandlerInterface`
+  - `Predis\Protocol\ICommandSerializer`
+      => `Predis\Protocol\CommandSerializerInterface`
+  - `Predis\Protocol\IComposableProtocolProcessor`
+      => `Predis\Protocol\ComposableProtocolInterface`
+  - `Predis\Network\IConnection` => `Predis\Connection\ConnectionInterface`
+  - `Predis\Network\IConnectionSingle`
+      => `Predis\Connection\SingleConnectionInterface`
+  - `Predis\Network\IConnectionComposable`
+      => `Predis\Connection\ComposableConnectionInterface`
+  - `Predis\Network\IConnectionCluster`
+      => `Predis\Connection\ClusterConnectionInterface`
+  - `Predis\Network\IConnectionReplication`
+      => `Predis\Connection\ReplicationConnectionInterface`
+  - `Predis\Commands\ICommand` => `Predis\Command\CommandInterface`
+  - `Predis\Commands\IPrefixable`
+      => `Predis\Command\PrefixableCommandInterface`
+  - `Predis\Command\Processor\ICommandProcessor`
+      => `Predis\Command\Processor\CommandProcessorInterface`
+  - `Predis\Command\Processor\ICommandProcessorChain`
+      => `Predis\Command\Processor\CommandProcessorChainInterface`
+  - `Predis\Command\Processor\IProcessingSupport`
+      => `Predis\Command\Processor\CommandProcessingInterface`
+
+- Some classes have been renamed:
+
+  - `Predis\Commands\Command` => `Predis\Command\AbstractCommand`
+  - `Predis\Network\ConnectionBase` => `Predis\Connection\AbstractConnection`
+
+- Some interfaces and classes have been moved to different namespaces:
+
+  - `Predis\MonitorContext` is now under the `Predis\Monitor`.
+
+- `Predis\Options\Option` is now abstract, see `Predis\Option\AbstractOption`.
+
+
 v0.7.2 (2012-xx-xx)
 ===============================================================================
 

+ 1 - 1
FAQ.PERFORMANCES.md

@@ -56,7 +56,7 @@ official Redis C client library) with a thin layer that exposes its features to
 get the benefits of a faster protocol parser just by adding a single line of code in your application:
 
     $client = new Predis\Client('tcp://127.0.0.1', array(
-        'connections' => array('tcp' => 'Predis\Network\PhpiredisConnection')
+        'connections' => array('tcp' => 'Predis\Connection\PhpiredisConnection')
     ));
 
 As simple as it is, nothing will really change in the way you use the library in your application. So,

+ 5 - 5
README.md

@@ -114,11 +114,11 @@ $replies = $redis->pipeline(function($pipe) {
 
 Predis allows developers to create new connection classes to add support for new protocols or override
 the existing ones and provide a different implementation compared to the default classes. This can be
-obtained by subclassing the `Predis\Network\IConnectionSingle` interface.
+obtained by implementing `Predis\Connection\SingleConnectionInterface`.
 
 ``` php
 <?php
-class MyConnectionClass implements Predis\Network\IConnectionSingle
+class MyConnectionClass implements Predis\Connection\SingleConnectionInterface
 {
     // implementation goes here
 }
@@ -129,8 +129,8 @@ $client = new Predis\Client('tcp://127.0.0.1', array(
 ));
 ```
 
-The classes contained in the `Predis\Network` namespace give you a better insight with actual code on
-how to create new connection classes.
+The classes contained in the `Predis\Connection` namespace give you a better insight with actual code
+on how to create new connection classes.
 
 
 ### Defining and registering new commands on the client at runtime ###
@@ -143,7 +143,7 @@ runtime. Actually, it is easier done than said:
 
 ``` php
 <?php
-class BrandNewRedisCommand extends Predis\Commands\Command
+class BrandNewRedisCommand extends Predis\Command\AbstractCommand
 {
     public function getId()
     {

+ 11 - 11
bin/generate-command-test.php

@@ -13,9 +13,9 @@
 // -------------------------------------------------------------------------- //
 // This script can be used to automatically generate a file with the scheleton
 // of a test case to test a Redis command by specifying the name of the class
-// in the Predis\Commands namespace (only classes in this namespace are valid).
+// in the Predis\Command namespace (only classes in this namespace are valid).
 // For example, to generate a test case for SET (which is represented by the
-// Predis\Commands\StringSet class):
+// Predis\Command\StringSet class):
 //
 //   $ ./bin/generate-command-test.php --class=StringSet
 //
@@ -33,8 +33,8 @@
 // is explicitly specified.
 // -------------------------------------------------------------------------- //
 
-use Predis\Commands\ICommand;
-use Predis\Commands\IPrefixable;
+use Predis\Command\CommandInterface;
+use Predis\Command\PrefixableCommandInterface;
 
 class CommandTestCaseGenerator
 {
@@ -92,8 +92,8 @@ class CommandTestCaseGenerator
             throw new RuntimeException("Missing 'class' option.");
         }
 
-        $options['fqn'] = "Predis\\Commands\\{$options['class']}";
-        $options['path'] = "Predis/Commands/{$options['class']}.php";
+        $options['fqn'] = "Predis\\Command\\{$options['class']}";
+        $options['path'] = "Predis/Command/{$options['class']}.php";
 
         $source = __DIR__.'/../lib/'.$options['path'];
         if (!file_exists($source)) {
@@ -129,8 +129,8 @@ class CommandTestCaseGenerator
         if (!$reflection->isInstantiable()) {
             throw new RuntimeException("Class $class must be instantiable, abstract classes or interfaces are not allowed.");
         }
-        if (!$reflection->implementsInterface('Predis\Commands\ICommand')) {
-            throw new RuntimeException("Class $class must implement the Predis\Commands\ICommand interface.");
+        if (!$reflection->implementsInterface('Predis\Command\CommandInterface')) {
+            throw new RuntimeException("Class $class must implement Predis\Command\CommandInterface.");
         }
 
         $instance = $reflection->newInstance();
@@ -148,7 +148,7 @@ class CommandTestCaseGenerator
         file_put_contents($options['output'], $this->generate());
     }
 
-    protected function getTestCaseBuffer(ICommand $instance)
+    protected function getTestCaseBuffer(CommandInterface $instance)
     {
         $id = $instance->getId();
         $fqn = get_class($instance);
@@ -167,7 +167,7 @@ class CommandTestCaseGenerator
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use \PHPUnit_Framework_TestCase as StandardTestCase;
 
@@ -226,7 +226,7 @@ class $class extends CommandTestCase
 
 PHP;
 
-        if ($instance instanceof IPrefixable) {
+        if ($instance instanceof PrefixableCommandInterface) {
             $buffer .=<<<PHP
 
     /**

+ 5 - 5
examples/CustomDistributionStrategy.php

@@ -13,12 +13,12 @@ require 'SharedConfigurations.php';
 
 // Developers can customize the distribution strategy used by the client
 // to distribute keys among a cluster of servers simply by creating a class
-// that implements the Predis\Distribution\IDistributionStrategy interface.
+// that implements Predis\Distribution\DistributionStrategyInterface.
 
-use Predis\Distribution\IDistributionStrategy;
-use Predis\Network\PredisCluster;
+use Predis\Distribution\DistributionStrategyInterface;
+use Predis\Connection\PredisCluster;
 
-class NaiveDistributionStrategy implements IDistributionStrategy
+class NaiveDistributionStrategy implements DistributionStrategyInterface
 {
     private $nodes;
     private $nodesCount;
@@ -54,7 +54,7 @@ class NaiveDistributionStrategy implements IDistributionStrategy
         return $this->nodes[$count > 1 ? abs(crc32($key) % $count) : 0];
     }
 
-    public function generateKey($value)
+    public function hash($value)
     {
         return crc32($value);
     }

+ 4 - 4
examples/MasterSlaveReplicationComplex.php

@@ -13,14 +13,14 @@ require 'SharedConfigurations.php';
 
 // Predis allows to set Lua scripts as read-only operations in the context of
 // replication. This works for both EVAL and EVALSHA and also for the client-side
-// abstraction built upon them (Predis\Commands\ScriptedCommand). This example
+// abstraction built upon them (Predis\Command\ScriptedCommand). This example
 // shows a slightly more complex configuration that injects a new scripted command
 // in the server profile used by the new client instance and marks it marks it as
 // a read-only operation for replication so that it will be executed on slaves.
 
-use Predis\Profiles\ServerProfile;
-use Predis\Commands\ScriptedCommand;
-use Predis\Network\MasterSlaveReplication;
+use Predis\Profile\ServerProfile;
+use Predis\Command\ScriptedCommand;
+use Predis\Connection\MasterSlaveReplication;
 
 // ------------------------------------------------------------------------- //
 

+ 2 - 2
examples/ServerSideScripting.php

@@ -14,11 +14,11 @@ require 'SharedConfigurations.php';
 // This example will not work with versions of Redis < 2.6.
 //
 // Additionally to the EVAL command defined in the current development profile, the new
-// Predis\Commands\ScriptedCommand base class can be used to build an higher abstraction
+// Predis\Command\ScriptedCommand base class can be used to build an higher abstraction
 // for our "scripted" commands so that they will appear just like any other command on
 // the client-side. This is a quick example used to implement INCREX.
 
-use Predis\Commands\ScriptedCommand;
+use Predis\Command\ScriptedCommand;
 
 class IncrementExistingKey extends ScriptedCommand
 {

+ 5 - 5
examples/SimpleDebuggableConnection.php

@@ -12,8 +12,8 @@
 require 'SharedConfigurations.php';
 
 use Predis\ConnectionParameters;
-use Predis\Commands\ICommand;
-use Predis\Network\StreamConnection;
+use Predis\Command\CommandInterface;
+use Predis\Connection\StreamConnection;
 
 class SimpleDebuggableConnection extends StreamConnection
 {
@@ -27,7 +27,7 @@ class SimpleDebuggableConnection extends StreamConnection
         parent::connect();
     }
 
-    private function storeDebug(ICommand $command, $direction)
+    private function storeDebug(CommandInterface $command, $direction)
     {
         $firtsArg  = $command->getArgument(0);
         $timestamp = round(microtime(true) - $this->tstart, 4);
@@ -40,14 +40,14 @@ class SimpleDebuggableConnection extends StreamConnection
         $this->debugBuffer[] = $debug;
     }
 
-    public function writeCommand(ICommand $command)
+    public function writeCommand(CommandInterface $command)
     {
         parent::writeCommand($command);
 
         $this->storeDebug($command, '->');
     }
 
-    public function readResponse(ICommand $command)
+    public function readResponse(CommandInterface $command)
     {
         $reply = parent::readResponse($command);
         $this->storeDebug($command, '<-');

+ 23 - 23
lib/Predis/Client.php

@@ -11,14 +11,14 @@
 
 namespace Predis;
 
-use Predis\Commands\ICommand;
-use Predis\Options\IClientOptions;
-use Predis\Network\IConnection;
-use Predis\Network\IConnectionSingle;
-use Predis\Profiles\IServerProfile;
-use Predis\Options\ClientOptions;
-use Predis\Profiles\ServerProfile;
+use Predis\Command\CommandInterface;
+use Predis\Option\ClientOptionsInterface;
+use Predis\Connection\ConnectionInterface;
+use Predis\Profile\ServerProfileInterface;
+use Predis\Option\ClientOptions;
+use Predis\Profile\ServerProfile;
 use Predis\PubSub\PubSubContext;
+use Predis\Monitor\MonitorContext;
 use Predis\Pipeline\PipelineContext;
 use Predis\Transaction\MultiExecContext;
 
@@ -52,9 +52,9 @@ class Client
     }
 
     /**
-     * Creates an instance of Predis\Options\ClientOptions from various types of
-     * arguments (string, array, Predis\Profiles\ServerProfile) or returns the
-     * passed object if it is an instance of Predis\Options\ClientOptions.
+     * Creates an instance of Predis\Option\ClientOptions from various types of
+     * 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.
      * @return ClientOptions
@@ -67,10 +67,10 @@ class Client
         if (is_array($options)) {
             return new ClientOptions($options);
         }
-        if ($options instanceof IClientOptions) {
+        if ($options instanceof ClientOptionsInterface) {
             return $options;
         }
-        if ($options instanceof IServerProfile || is_string($options)) {
+        if ($options instanceof ServerProfileInterface || is_string($options)) {
             return new ClientOptions(array('profile' => $options));
         }
 
@@ -80,14 +80,14 @@ class Client
     /**
      * Initializes one or multiple connection (cluster) objects from various
      * types of arguments (string, array) or returns the passed object if it
-     * implements the Predis\Network\IConnection interface.
+     * implements Predis\Connection\ConnectionInterface.
      *
      * @param mixed $parameters Connection parameters or instance.
-     * @return IConnection
+     * @return ConnectionInterface
      */
     protected function initializeConnection($parameters)
     {
-        if ($parameters instanceof IConnection) {
+        if ($parameters instanceof ConnectionInterface) {
             return $parameters;
         }
 
@@ -106,7 +106,7 @@ class Client
     /**
      * Returns the server profile used by the client.
      *
-     * @return IServerProfile
+     * @return ServerProfileInterface
      */
     public function getProfile()
     {
@@ -126,7 +126,7 @@ class Client
     /**
      * Returns the connection factory object used by the client.
      *
-     * @return IConnectionFactory
+     * @return ConnectionFactoryInterface
      */
     public function getConnectionFactory()
     {
@@ -191,7 +191,7 @@ class Client
      * one of the connection instances identified by its alias.
      *
      * @param string $id The alias of a connection when connected to a cluster.
-     * @return IConnection
+     * @return ConnectionInterface
      */
     public function getConnection($id = null)
     {
@@ -224,7 +224,7 @@ class Client
      *
      * @param string $method The name of a Redis command.
      * @param array $arguments The arguments for the command.
-     * @return ICommand
+     * @return CommandInterface
      */
     public function createCommand($method, $arguments = array())
     {
@@ -234,10 +234,10 @@ class Client
     /**
      * Executes the specified Redis command.
      *
-     * @param ICommand $command A Redis command.
+     * @param CommandInterface $command A Redis command.
      * @return mixed
      */
-    public function executeCommand(ICommand $command)
+    public function executeCommand(CommandInterface $command)
     {
         return $this->connection->executeCommand($command);
     }
@@ -245,10 +245,10 @@ class Client
     /**
      * Executes the specified Redis command on all the nodes of a cluster.
      *
-     * @param ICommand $command A Redis command.
+     * @param CommandInterface $command A Redis command.
      * @return array
      */
-    public function executeCommandOnShards(ICommand $command)
+    public function executeCommandOnShards(CommandInterface $command)
     {
         if (Helpers::isCluster($this->connection)) {
             $replies = array();

+ 5 - 5
lib/Predis/Commands/Command.php → lib/Predis/Command/AbstractCommand.php

@@ -9,17 +9,17 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
-use Predis\Distribution\INodeKeyGenerator;
+use Predis\Distribution\HashGeneratorInterface;
 
 /**
  * Base class for Redis commands.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-abstract class Command implements ICommand
+abstract class AbstractCommand implements CommandInterface
 {
     private $hash;
     private $arguments = array();
@@ -113,7 +113,7 @@ abstract class Command implements ICommand
     /**
      * {@inheritdoc}
      */
-    public function getHash(INodeKeyGenerator $distributor)
+    public function getHash(HashGeneratorInterface $hasher)
     {
         if (isset($this->hash)) {
             return $this->hash;
@@ -121,7 +121,7 @@ abstract class Command implements ICommand
 
         if ($this->canBeHashed()) {
             $key = Helpers::extractKeyTag($this->arguments[0]);
-            $this->hash = $distributor->generateKey($key);
+            $this->hash = $hasher->hash($key);
 
             return $this->hash;
         }

+ 5 - 5
lib/Predis/Commands/ICommand.php → lib/Predis/Command/CommandInterface.php

@@ -9,15 +9,15 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
-use Predis\Distribution\INodeKeyGenerator;
+use Predis\Distribution\HashGeneratorInterface;
 
 /**
  * Defines an abstraction representing a Redis command.
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-interface ICommand
+interface CommandInterface
 {
     /**
      * Gets the ID of a Redis command.
@@ -30,10 +30,10 @@ interface ICommand
      * Returns an hash of the command using the provided algorithm against the
      * key (used to calculate the distribution of keys with client-side sharding).
      *
-     * @param INodeKeyGenerator $distributor Distribution algorithm.
+     * @param HashGeneratorInterface $hasher Distribution algorithm.
      * @return int
      */
-    public function getHash(INodeKeyGenerator $distributor);
+    public function getHash(HashGeneratorInterface $hasher);
 
     /**
      * Sets the arguments of the command.

+ 2 - 2
lib/Predis/Commands/ConnectionAuth.php → lib/Predis/Command/ConnectionAuth.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/auth
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ConnectionAuth extends Command
+class ConnectionAuth extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ConnectionEcho.php → lib/Predis/Command/ConnectionEcho.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/echo
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ConnectionEcho extends Command
+class ConnectionEcho extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ConnectionPing.php → lib/Predis/Command/ConnectionPing.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/ping
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ConnectionPing extends Command
+class ConnectionPing extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ConnectionQuit.php → lib/Predis/Command/ConnectionQuit.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/quit
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ConnectionQuit extends Command
+class ConnectionQuit extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ConnectionSelect.php → lib/Predis/Command/ConnectionSelect.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/select
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ConnectionSelect extends Command
+class ConnectionSelect extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/HashDelete.php → lib/Predis/Command/HashDelete.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
 

+ 1 - 1
lib/Predis/Commands/HashExists.php → lib/Predis/Command/HashExists.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hexists

+ 1 - 1
lib/Predis/Commands/HashGet.php → lib/Predis/Command/HashGet.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hget

+ 2 - 2
lib/Predis/Commands/HashGetAll.php → lib/Predis/Command/HashGetAll.php

@@ -9,9 +9,9 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
-use Predis\Iterators\MultiBulkResponseTuple;
+use Predis\Iterator\MultiBulkResponseTuple;
 
 /**
  * @link http://redis.io/commands/hgetall

+ 1 - 1
lib/Predis/Commands/HashGetMultiple.php → lib/Predis/Command/HashGetMultiple.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
 

+ 1 - 1
lib/Predis/Commands/HashIncrementBy.php → lib/Predis/Command/HashIncrementBy.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hincrby

+ 1 - 1
lib/Predis/Commands/HashIncrementByFloat.php → lib/Predis/Command/HashIncrementByFloat.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hincrbyfloat

+ 1 - 1
lib/Predis/Commands/HashKeys.php → lib/Predis/Command/HashKeys.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hkeys

+ 1 - 1
lib/Predis/Commands/HashLength.php → lib/Predis/Command/HashLength.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hlen

+ 1 - 1
lib/Predis/Commands/HashSet.php → lib/Predis/Command/HashSet.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hset

+ 1 - 1
lib/Predis/Commands/HashSetMultiple.php → lib/Predis/Command/HashSetMultiple.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hmset

+ 1 - 1
lib/Predis/Commands/HashSetPreserve.php → lib/Predis/Command/HashSetPreserve.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hsetnx

+ 1 - 1
lib/Predis/Commands/HashValues.php → lib/Predis/Command/HashValues.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/hvals

+ 2 - 2
lib/Predis/Commands/KeyDelete.php → lib/Predis/Command/KeyDelete.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
 
@@ -17,7 +17,7 @@ use Predis\Helpers;
  * @link http://redis.io/commands/del
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class KeyDelete extends Command implements IPrefixable
+class KeyDelete extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/KeyExists.php → lib/Predis/Command/KeyExists.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/exists

+ 1 - 1
lib/Predis/Commands/KeyExpire.php → lib/Predis/Command/KeyExpire.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/expire

+ 1 - 1
lib/Predis/Commands/KeyExpireAt.php → lib/Predis/Command/KeyExpireAt.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/expireat

+ 1 - 1
lib/Predis/Commands/KeyKeys.php → lib/Predis/Command/KeyKeys.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/keys

+ 1 - 1
lib/Predis/Commands/KeyKeysV12x.php → lib/Predis/Command/KeyKeysV12x.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/keys

+ 1 - 1
lib/Predis/Commands/KeyMove.php → lib/Predis/Command/KeyMove.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/move

+ 1 - 1
lib/Predis/Commands/KeyPersist.php → lib/Predis/Command/KeyPersist.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/persist

+ 1 - 1
lib/Predis/Commands/KeyPreciseExpire.php → lib/Predis/Command/KeyPreciseExpire.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/pexpire

+ 1 - 1
lib/Predis/Commands/KeyPreciseExpireAt.php → lib/Predis/Command/KeyPreciseExpireAt.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/pexpireat

+ 1 - 1
lib/Predis/Commands/KeyPreciseTimeToLive.php → lib/Predis/Command/KeyPreciseTimeToLive.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/pttl

+ 2 - 2
lib/Predis/Commands/KeyRandom.php → lib/Predis/Command/KeyRandom.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/randomkey
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class KeyRandom extends Command
+class KeyRandom extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/KeyRename.php → lib/Predis/Command/KeyRename.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/rename
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class KeyRename extends Command implements IPrefixable
+class KeyRename extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/KeyRenamePreserve.php → lib/Predis/Command/KeyRenamePreserve.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/renamenx

+ 2 - 2
lib/Predis/Commands/KeySort.php → lib/Predis/Command/KeySort.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/sort
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class KeySort extends Command implements IPrefixable
+class KeySort extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/KeyTimeToLive.php → lib/Predis/Command/KeyTimeToLive.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/ttl

+ 1 - 1
lib/Predis/Commands/KeyType.php → lib/Predis/Command/KeyType.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/type

+ 1 - 1
lib/Predis/Commands/ListIndex.php → lib/Predis/Command/ListIndex.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/lindex

+ 1 - 1
lib/Predis/Commands/ListInsert.php → lib/Predis/Command/ListInsert.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/linsert

+ 1 - 1
lib/Predis/Commands/ListLength.php → lib/Predis/Command/ListLength.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/llen

+ 1 - 1
lib/Predis/Commands/ListPopFirst.php → lib/Predis/Command/ListPopFirst.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/lpop

+ 2 - 2
lib/Predis/Commands/ListPopFirstBlocking.php → lib/Predis/Command/ListPopFirstBlocking.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/blpop
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ListPopFirstBlocking extends Command implements IPrefixable
+class ListPopFirstBlocking extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/ListPopLast.php → lib/Predis/Command/ListPopLast.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/rpop

+ 1 - 1
lib/Predis/Commands/ListPopLastBlocking.php → lib/Predis/Command/ListPopLastBlocking.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/brpop

+ 2 - 2
lib/Predis/Commands/ListPopLastPushHead.php → lib/Predis/Command/ListPopLastPushHead.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/rpoplpush
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ListPopLastPushHead extends Command implements IPrefixable
+class ListPopLastPushHead extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ListPopLastPushHeadBlocking.php → lib/Predis/Command/ListPopLastPushHeadBlocking.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/brpoplpush
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ListPopLastPushHeadBlocking extends Command implements IPrefixable
+class ListPopLastPushHeadBlocking extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/ListPushHead.php → lib/Predis/Command/ListPushHead.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/lpush

+ 1 - 1
lib/Predis/Commands/ListPushHeadX.php → lib/Predis/Command/ListPushHeadX.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/lpushx

+ 1 - 1
lib/Predis/Commands/ListPushTail.php → lib/Predis/Command/ListPushTail.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
 

+ 1 - 1
lib/Predis/Commands/ListPushTailX.php → lib/Predis/Command/ListPushTailX.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/rpushx

+ 1 - 1
lib/Predis/Commands/ListRange.php → lib/Predis/Command/ListRange.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/lrange

+ 1 - 1
lib/Predis/Commands/ListRemove.php → lib/Predis/Command/ListRemove.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/lrem

+ 1 - 1
lib/Predis/Commands/ListSet.php → lib/Predis/Command/ListSet.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/lset

+ 1 - 1
lib/Predis/Commands/ListTrim.php → lib/Predis/Command/ListTrim.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/ltrim

+ 9 - 9
lib/Predis/Commands/PrefixHelpers.php → lib/Predis/Command/PrefixHelpers.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * Class that defines a few helpers method for prefixing keys.
@@ -21,10 +21,10 @@ class PrefixHelpers
     /**
      * Applies the specified prefix only the first argument.
      *
-     * @param ICommand $command Command instance.
+     * @param CommandInterface $command Command instance.
      * @param string $prefix Prefix string.
      */
-    public static function first(ICommand $command, $prefix)
+    public static function first(CommandInterface $command, $prefix)
     {
         if ($arguments = $command->getArguments()) {
             $arguments[0] = "$prefix{$arguments[0]}";
@@ -35,10 +35,10 @@ class PrefixHelpers
     /**
      * Applies the specified prefix to all the arguments.
      *
-     * @param ICommand $command Command instance.
+     * @param CommandInterface $command Command instance.
      * @param string $prefix Prefix string.
      */
-    public static function all(ICommand $command, $prefix)
+    public static function all(CommandInterface $command, $prefix)
     {
         $arguments = $command->getArguments();
 
@@ -52,10 +52,10 @@ class PrefixHelpers
     /**
      * Applies the specified prefix only to even arguments in the list.
      *
-     * @param ICommand $command Command instance.
+     * @param CommandInterface $command Command instance.
      * @param string $prefix Prefix string.
      */
-    public static function interleaved(ICommand $command, $prefix)
+    public static function interleaved(CommandInterface $command, $prefix)
     {
         $arguments = $command->getArguments();
         $length = count($arguments);
@@ -70,10 +70,10 @@ class PrefixHelpers
     /**
      * Applies the specified prefix to all the arguments but the last one.
      *
-     * @param ICommand $command Command instance.
+     * @param CommandInterface $command Command instance.
      * @param string $prefix Prefix string.
      */
-    public static function skipLast(ICommand $command, $prefix)
+    public static function skipLast(CommandInterface $command, $prefix)
     {
         $arguments = $command->getArguments();
         $length = count($arguments);

+ 2 - 2
lib/Predis/Commands/PrefixableCommand.php → lib/Predis/Command/PrefixableCommand.php

@@ -9,14 +9,14 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * Base class for Redis commands with prefixable keys.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-abstract class PrefixableCommand extends Command implements IPrefixable
+abstract class PrefixableCommand extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 2 - 4
lib/Predis/Commands/IPrefixable.php → lib/Predis/Command/PrefixableCommandInterface.php

@@ -9,16 +9,14 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
-
-use Predis\Distribution\INodeKeyGenerator;
+namespace Predis\Command;
 
 /**
  * Defines a command whose keys can be prefixed.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-interface IPrefixable
+interface PrefixableCommandInterface
 {
     /**
      * Prefixes all the keys found in the arguments of the command.

+ 5 - 5
lib/Predis/Commands/Processors/IProcessingSupport.php → lib/Predis/Command/Processor/CommandProcessingInterface.php

@@ -9,26 +9,26 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands\Processors;
+namespace Predis\Command\Processor;
 
 /**
  * Defines an object that can process commands using command processors.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-interface IProcessingSupport
+interface CommandProcessingInterface
 {
     /**
      * Associates a command processor.
      *
-     * @param ICommandProcessor $processor The command processor.
+     * @param CommandProcessorInterface $processor The command processor.
      */
-    public function setProcessor(ICommandProcessor $processor);
+    public function setProcessor(CommandProcessorInterface $processor);
 
     /**
      * Returns the associated command processor.
      *
-     * @return ICommandProcessor
+     * @return CommandProcessorInterface
      */
     public function getProcessor();
 }

+ 6 - 6
lib/Predis/Commands/Processors/ICommandProcessorChain.php → lib/Predis/Command/Processor/CommandProcessorChainInterface.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands\Processors;
+namespace Predis\Command\Processor;
 
 /**
  * A command processor chain processes a command using multiple chained command
@@ -17,21 +17,21 @@ namespace Predis\Commands\Processors;
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-interface ICommandProcessorChain extends ICommandProcessor, \IteratorAggregate, \Countable
+interface CommandProcessorChainInterface extends CommandProcessorInterface, \IteratorAggregate, \Countable
 {
     /**
      * Adds a command processor.
      *
-     * @param ICommandProcessor $processor A command processor.
+     * @param CommandProcessorInterface $processor A command processor.
      */
-    public function add(ICommandProcessor $processor);
+    public function add(CommandProcessorInterface $processor);
 
     /**
      * Removes a command processor from the chain.
      *
-     * @param ICommandProcessor $processor A command processor.
+     * @param CommandProcessorInterface $processor A command processor.
      */
-    public function remove(ICommandProcessor $processor);
+    public function remove(CommandProcessorInterface $processor);
 
     /**
      * Returns an ordered list of the command processors in the chain.

+ 5 - 5
lib/Predis/Commands/Processors/ICommandProcessor.php → lib/Predis/Command/Processor/CommandProcessorInterface.php

@@ -9,21 +9,21 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands\Processors;
+namespace Predis\Command\Processor;
 
-use Predis\Commands\ICommand;
+use Predis\Command\CommandInterface;
 
 /**
  * A command processor processes commands before they are sent to Redis.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-interface ICommandProcessor
+interface CommandProcessorInterface
 {
     /**
      * Processes a Redis command.
      *
-     * @param ICommand $command Redis command.
+     * @param CommandInterface $command Redis command.
      */
-    public function process(ICommand $command);
+    public function process(CommandInterface $command);
 }

+ 6 - 6
lib/Predis/Commands/Processors/KeyPrefixProcessor.php → lib/Predis/Command/Processor/KeyPrefixProcessor.php

@@ -9,10 +9,10 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands\Processors;
+namespace Predis\Command\Processor;
 
-use Predis\Commands\ICommand;
-use Predis\Commands\IPrefixable;
+use Predis\Command\CommandInterface;
+use Predis\Command\PrefixableCommandInterface;
 
 /**
  * Command processor that is used to prefix the keys contained in the arguments
@@ -20,7 +20,7 @@ use Predis\Commands\IPrefixable;
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class KeyPrefixProcessor implements ICommandProcessor
+class KeyPrefixProcessor implements CommandProcessorInterface
 {
     private $prefix;
 
@@ -55,9 +55,9 @@ class KeyPrefixProcessor implements ICommandProcessor
     /**
      * {@inheritdoc}
      */
-    public function process(ICommand $command)
+    public function process(CommandInterface $command)
     {
-        if ($command instanceof IPrefixable) {
+        if ($command instanceof PrefixableCommandInterface) {
             $command->prefixKeys($this->prefix);
         }
     }

+ 9 - 9
lib/Predis/Commands/Processors/ProcessorChain.php → lib/Predis/Command/Processor/ProcessorChain.php

@@ -9,21 +9,21 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands\Processors;
+namespace Predis\Command\Processor;
 
-use Predis\Commands\ICommand;
+use Predis\Command\CommandInterface;
 
 /**
  * Default implementation of a command processors chain.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ProcessorChain implements ICommandProcessorChain, \ArrayAccess
+class ProcessorChain implements CommandProcessorChainInterface, \ArrayAccess
 {
     private $processors = array();
 
     /**
-     * @param array $processors List of instances of ICommandProcessor.
+     * @param array $processors List of instances of CommandProcessorInterface.
      */
     public function __construct($processors = array())
     {
@@ -35,7 +35,7 @@ class ProcessorChain implements ICommandProcessorChain, \ArrayAccess
     /**
      * {@inheritdoc}
      */
-    public function add(ICommandProcessor $processor)
+    public function add(CommandProcessorInterface $processor)
     {
         $this->processors[] = $processor;
     }
@@ -43,7 +43,7 @@ class ProcessorChain implements ICommandProcessorChain, \ArrayAccess
     /**
      * {@inheritdoc}
      */
-    public function remove(ICommandProcessor $processor)
+    public function remove(CommandProcessorInterface $processor)
     {
         $index = array_search($processor, $this->processors, true);
         if ($index !== false) {
@@ -54,7 +54,7 @@ class ProcessorChain implements ICommandProcessorChain, \ArrayAccess
     /**
      * {@inheritdoc}
      */
-    public function process(ICommand $command)
+    public function process(CommandInterface $command)
     {
         $count = count($this->processors);
         for ($i = 0; $i < $count; $i++) {
@@ -111,10 +111,10 @@ class ProcessorChain implements ICommandProcessorChain, \ArrayAccess
      */
     public function offsetSet($index, $processor)
     {
-        if (!$processor instanceof ICommandProcessor) {
+        if (!$processor instanceof CommandProcessorInterface) {
             throw new \InvalidArgumentException(
                 'A processor chain can hold only instances of classes implementing '.
-                'the Predis\Commands\Preprocessors\ICommandProcessor interface'
+                'the Predis\Command\Processor\CommandProcessorInterface interface'
             );
         }
 

+ 1 - 1
lib/Predis/Commands/PubSubPublish.php → lib/Predis/Command/PubSubPublish.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/publish

+ 2 - 2
lib/Predis/Commands/PubSubSubscribe.php → lib/Predis/Command/PubSubSubscribe.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
 
@@ -17,7 +17,7 @@ use Predis\Helpers;
  * @link http://redis.io/commands/subscribe
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class PubSubSubscribe extends Command implements IPrefixable
+class PubSubSubscribe extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/PubSubSubscribeByPattern.php → lib/Predis/Command/PubSubSubscribeByPattern.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
 

+ 2 - 2
lib/Predis/Commands/PubSubUnsubscribe.php → lib/Predis/Command/PubSubUnsubscribe.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
 
@@ -17,7 +17,7 @@ use Predis\Helpers;
  * @link http://redis.io/commands/unsubscribe
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class PubSubUnsubscribe extends Command implements IPrefixable
+class PubSubUnsubscribe extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/PubSubUnsubscribeByPattern.php → lib/Predis/Command/PubSubUnsubscribeByPattern.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/punsubscribe

+ 1 - 1
lib/Predis/Commands/ScriptedCommand.php → lib/Predis/Command/ScriptedCommand.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * Base class used to implement an higher level abstraction for "virtual"

+ 2 - 2
lib/Predis/Commands/ServerBackgroundRewriteAOF.php → lib/Predis/Command/ServerBackgroundRewriteAOF.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/bgrewriteaof
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerBackgroundRewriteAOF extends Command
+class ServerBackgroundRewriteAOF extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerBackgroundSave.php → lib/Predis/Command/ServerBackgroundSave.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/bgsave
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerBackgroundSave extends Command
+class ServerBackgroundSave extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerClient.php → lib/Predis/Command/ServerClient.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/client
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerClient extends Command
+class ServerClient extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 3 - 3
lib/Predis/Commands/ServerConfig.php → lib/Predis/Command/ServerConfig.php

@@ -9,9 +9,9 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
-use Predis\Iterators\MultiBulkResponseTuple;
+use Predis\Iterator\MultiBulkResponseTuple;
 
 /**
  * @link http://redis.io/commands/config-set
@@ -19,7 +19,7 @@ use Predis\Iterators\MultiBulkResponseTuple;
  * @link http://redis.io/commands/config-resetstat
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerConfig extends Command
+class ServerConfig extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerDatabaseSize.php → lib/Predis/Command/ServerDatabaseSize.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/dbsize
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerDatabaseSize extends Command
+class ServerDatabaseSize extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerEval.php → lib/Predis/Command/ServerEval.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/eval
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerEval extends Command implements IPrefixable
+class ServerEval extends AbstractCommand implements PrefixableCommandInterface
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/ServerEvalSHA.php → lib/Predis/Command/ServerEvalSHA.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/evalsha

+ 2 - 2
lib/Predis/Commands/ServerFlushAll.php → lib/Predis/Command/ServerFlushAll.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/flushall
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerFlushAll extends Command
+class ServerFlushAll extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerFlushDatabase.php → lib/Predis/Command/ServerFlushDatabase.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/flushdb
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerFlushDatabase extends Command
+class ServerFlushDatabase extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerInfo.php → lib/Predis/Command/ServerInfo.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/info
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerInfo extends Command
+class ServerInfo extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/ServerInfoV26x.php → lib/Predis/Command/ServerInfoV26x.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/info

+ 2 - 2
lib/Predis/Commands/ServerLastSave.php → lib/Predis/Command/ServerLastSave.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/lastsave
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerLastSave extends Command
+class ServerLastSave extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerMonitor.php → lib/Predis/Command/ServerMonitor.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/monitor
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerMonitor extends Command
+class ServerMonitor extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerObject.php → lib/Predis/Command/ServerObject.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
 
@@ -17,7 +17,7 @@ use Predis\Helpers;
  * @link http://redis.io/commands/object
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerObject extends Command
+class ServerObject extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerSave.php → lib/Predis/Command/ServerSave.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/save
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerSave extends Command
+class ServerSave extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerScript.php → lib/Predis/Command/ServerScript.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/script
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerScript extends Command
+class ServerScript extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerShutdown.php → lib/Predis/Command/ServerShutdown.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/shutdown
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerShutdown extends Command
+class ServerShutdown extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/Commands/ServerSlaveOf.php → lib/Predis/Command/ServerSlaveOf.php

@@ -9,13 +9,13 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/slaveof
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerSlaveOf extends Command
+class ServerSlaveOf extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 3 - 3
lib/Predis/Commands/ServerSlowlog.php → lib/Predis/Command/ServerSlowlog.php

@@ -9,15 +9,15 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
-use Predis\Iterators\MultiBulkResponse;
+use Predis\Iterator\MultiBulkResponse;
 
 /**
  * @link http://redis.io/commands/slowlog
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ServerSlowlog extends Command
+class ServerSlowlog extends AbstractCommand
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Commands/SetAdd.php → lib/Predis/Command/SetAdd.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 use Predis\Helpers;
 

+ 1 - 1
lib/Predis/Commands/SetCardinality.php → lib/Predis/Command/SetCardinality.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/scard

+ 1 - 1
lib/Predis/Commands/SetDifference.php → lib/Predis/Command/SetDifference.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/sdiff

+ 1 - 1
lib/Predis/Commands/SetDifferenceStore.php → lib/Predis/Command/SetDifferenceStore.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Commands;
+namespace Predis\Command;
 
 /**
  * @link http://redis.io/commands/sdiffstore

Some files were not shown because too many files changed in this diff