浏览代码

Apply some coding style changes.

Daniele Alessandri 13 年之前
父节点
当前提交
20d872a306
共有 100 个文件被更改,包括 1011 次插入477 次删除
  1. 8 3
      README.markdown
  2. 8 2
      bin/createPhar.php
  3. 172 75
      bin/createSingleFile.php
  4. 16 7
      examples/CustomDistributionStrategy.php
  5. 10 5
      examples/DispatcherLoop.php
  6. 14 11
      examples/MultiExecTransactionsWithCAS.php
  7. 1 0
      examples/PubSubContext.php
  8. 8 3
      examples/ServerSideScripting.php
  9. 18 7
      examples/SimpleDebuggableConnection.php
  10. 8 4
      lib/Predis/Autoloader.php
  11. 87 48
      lib/Predis/Client.php
  12. 2 1
      lib/Predis/ClientException.php
  13. 25 15
      lib/Predis/ClientOptions.php
  14. 35 14
      lib/Predis/Commands/Command.php
  15. 8 4
      lib/Predis/Commands/ConnectionAuth.php
  16. 8 4
      lib/Predis/Commands/ConnectionEcho.php
  17. 10 5
      lib/Predis/Commands/ConnectionPing.php
  18. 8 4
      lib/Predis/Commands/ConnectionQuit.php
  19. 8 4
      lib/Predis/Commands/ConnectionSelect.php
  20. 8 4
      lib/Predis/Commands/HashDelete.php
  21. 6 3
      lib/Predis/Commands/HashExists.php
  22. 4 2
      lib/Predis/Commands/HashGet.php
  23. 8 3
      lib/Predis/Commands/HashGetAll.php
  24. 6 3
      lib/Predis/Commands/HashGetMultiple.php
  25. 4 2
      lib/Predis/Commands/HashIncrementBy.php
  26. 4 2
      lib/Predis/Commands/HashKeys.php
  27. 4 2
      lib/Predis/Commands/HashLength.php
  28. 4 2
      lib/Predis/Commands/HashSet.php
  29. 9 3
      lib/Predis/Commands/HashSetMultiple.php
  30. 6 3
      lib/Predis/Commands/HashSetPreserve.php
  31. 4 2
      lib/Predis/Commands/HashValues.php
  32. 2 1
      lib/Predis/Commands/ICommand.php
  33. 11 5
      lib/Predis/Commands/KeyDelete.php
  34. 6 3
      lib/Predis/Commands/KeyExists.php
  35. 6 3
      lib/Predis/Commands/KeyExpire.php
  36. 6 3
      lib/Predis/Commands/KeyExpireAt.php
  37. 6 3
      lib/Predis/Commands/KeyKeys.php
  38. 4 2
      lib/Predis/Commands/KeyKeysV12x.php
  39. 8 4
      lib/Predis/Commands/KeyMove.php
  40. 6 3
      lib/Predis/Commands/KeyPersist.php
  41. 8 4
      lib/Predis/Commands/KeyRandom.php
  42. 6 3
      lib/Predis/Commands/KeyRename.php
  43. 6 3
      lib/Predis/Commands/KeyRenamePreserve.php
  44. 17 4
      lib/Predis/Commands/KeySort.php
  45. 4 2
      lib/Predis/Commands/KeyTimeToLive.php
  46. 4 2
      lib/Predis/Commands/KeyType.php
  47. 4 2
      lib/Predis/Commands/ListIndex.php
  48. 4 2
      lib/Predis/Commands/ListInsert.php
  49. 4 2
      lib/Predis/Commands/ListLength.php
  50. 4 2
      lib/Predis/Commands/ListPopFirst.php
  51. 8 4
      lib/Predis/Commands/ListPopFirstBlocking.php
  52. 4 2
      lib/Predis/Commands/ListPopLast.php
  53. 4 2
      lib/Predis/Commands/ListPopLastBlocking.php
  54. 8 4
      lib/Predis/Commands/ListPopLastPushHead.php
  55. 8 4
      lib/Predis/Commands/ListPopLastPushHeadBlocking.php
  56. 4 2
      lib/Predis/Commands/ListPushHead.php
  57. 4 2
      lib/Predis/Commands/ListPushHeadX.php
  58. 6 3
      lib/Predis/Commands/ListPushTail.php
  59. 4 2
      lib/Predis/Commands/ListPushTailX.php
  60. 4 2
      lib/Predis/Commands/ListRange.php
  61. 4 2
      lib/Predis/Commands/ListRemove.php
  62. 4 2
      lib/Predis/Commands/ListSet.php
  63. 4 2
      lib/Predis/Commands/ListTrim.php
  64. 8 3
      lib/Predis/Commands/PrefixHelpers.php
  65. 2 1
      lib/Predis/Commands/Processors/ICommandProcessor.php
  66. 2 2
      lib/Predis/Commands/Processors/ICommandProcessorChain.php
  67. 2 1
      lib/Predis/Commands/Processors/IProcessingSupport.php
  68. 10 5
      lib/Predis/Commands/Processors/KeyPrefixProcessor.php
  69. 26 13
      lib/Predis/Commands/Processors/ProcessorChain.php
  70. 6 3
      lib/Predis/Commands/PubSubPublish.php
  71. 10 5
      lib/Predis/Commands/PubSubSubscribe.php
  72. 4 2
      lib/Predis/Commands/PubSubSubscribeByPattern.php
  73. 8 4
      lib/Predis/Commands/PubSubUnsubscribe.php
  74. 4 2
      lib/Predis/Commands/PubSubUnsubscribeByPattern.php
  75. 8 4
      lib/Predis/Commands/ScriptedCommand.php
  76. 10 5
      lib/Predis/Commands/ServerBackgroundRewriteAOF.php
  77. 11 5
      lib/Predis/Commands/ServerBackgroundSave.php
  78. 15 6
      lib/Predis/Commands/ServerClient.php
  79. 8 4
      lib/Predis/Commands/ServerConfig.php
  80. 8 4
      lib/Predis/Commands/ServerDatabaseSize.php
  81. 10 4
      lib/Predis/Commands/ServerEval.php
  82. 4 2
      lib/Predis/Commands/ServerEvalSHA.php
  83. 8 4
      lib/Predis/Commands/ServerFlushAll.php
  84. 8 4
      lib/Predis/Commands/ServerFlushDatabase.php
  85. 23 7
      lib/Predis/Commands/ServerInfo.php
  86. 11 4
      lib/Predis/Commands/ServerInfoV26x.php
  87. 8 4
      lib/Predis/Commands/ServerLastSave.php
  88. 8 4
      lib/Predis/Commands/ServerMonitor.php
  89. 8 4
      lib/Predis/Commands/ServerObject.php
  90. 8 4
      lib/Predis/Commands/ServerSave.php
  91. 6 3
      lib/Predis/Commands/ServerShutdown.php
  92. 11 5
      lib/Predis/Commands/ServerSlaveOf.php
  93. 8 4
      lib/Predis/Commands/SetAdd.php
  94. 4 2
      lib/Predis/Commands/SetCardinality.php
  95. 6 3
      lib/Predis/Commands/SetDifference.php
  96. 4 2
      lib/Predis/Commands/SetDifferenceStore.php
  97. 10 5
      lib/Predis/Commands/SetIntersection.php
  98. 11 5
      lib/Predis/Commands/SetIntersectionStore.php
  99. 6 3
      lib/Predis/Commands/SetIsMember.php
  100. 4 2
      lib/Predis/Commands/SetMembers.php

+ 8 - 3
README.markdown

@@ -109,7 +109,8 @@ classes. This can be obtained by subclassing the `Predis\Network\IConnectionSing
 
 
 ``` php
 ``` php
 <?php
 <?php
-class MyConnectionClass implements Predis\Network\IConnectionSingle {
+class MyConnectionClass implements Predis\Network\IConnectionSingle
+{
     // implementation goes here
     // implementation goes here
 }
 }
 
 
@@ -133,8 +134,12 @@ client instance at runtime. Actually, it is easier done than said:
 
 
 ``` php
 ``` php
 <?php
 <?php
-class BrandNewRedisCommand extends Predis\Commands\Command {
-    public function getId() { return 'NEWCMD'; }
+class BrandNewRedisCommand extends Predis\Commands\Command
+{
+    public function getId()
+    {
+        return 'NEWCMD';
+    }
 }
 }
 
 
 $redis = new Predis\Client();
 $redis = new Predis\Client();

+ 8 - 2
bin/createPhar.php

@@ -12,23 +12,29 @@ $options = array(
     'append_version' => true,
     'append_version' => true,
 );
 );
 
 
-function getPharFilename($options) {
+function getPharFilename($options)
+{
     $filename = $options['name'];
     $filename = $options['name'];
+
     // NOTE: do not consider "append_version" with Phar compression do to a bug in
     // NOTE: do not consider "append_version" with Phar compression do to a bug in
     // Phar::compress() when renaming phar archives containing dots in their name.
     // Phar::compress() when renaming phar archives containing dots in their name.
     if ($options['append_version'] && $options['compression'] === Phar::NONE) {
     if ($options['append_version'] && $options['compression'] === Phar::NONE) {
         $versionFile = @fopen(__DIR__ . '/../VERSION', 'r');
         $versionFile = @fopen(__DIR__ . '/../VERSION', 'r');
+
         if ($versionFile === false) {
         if ($versionFile === false) {
             throw new Exception("Could not locate the VERSION file.");
             throw new Exception("Could not locate the VERSION file.");
         }
         }
+
         $version = trim(fgets($versionFile));
         $version = trim(fgets($versionFile));
         fclose($versionFile);
         fclose($versionFile);
         $filename .= "_$version";
         $filename .= "_$version";
     }
     }
+
     return "$filename.phar";
     return "$filename.phar";
 }
 }
 
 
-function getPharStub($options) {
+function getPharStub($options)
+{
     return <<<EOSTUB
     return <<<EOSTUB
 <?php
 <?php
 Phar::mapPhar('predis.phar');
 Phar::mapPhar('predis.phar');

+ 172 - 75
bin/createSingleFile.php

@@ -13,8 +13,10 @@
 
 
 /* -------------------------------------------------------------------------- */
 /* -------------------------------------------------------------------------- */
 
 
-class CommandLine {
-    public static function getOptions() {
+class CommandLine
+{
+    public static function getOptions()
+    {
         $parameters = array(
         $parameters = array(
             's:'  => 'source:',
             's:'  => 'source:',
             'o:'  => 'output:',
             'o:'  => 'output:',
@@ -23,6 +25,7 @@ class CommandLine {
         );
         );
 
 
         $getops = getopt(implode(array_keys($parameters)), $parameters);
         $getops = getopt(implode(array_keys($parameters)), $parameters);
+
         $options = array(
         $options = array(
             'source'  => __DIR__ . "/../lib/",
             'source'  => __DIR__ . "/../lib/",
             'output'  => PredisFile::NS_ROOT . '.php',
             'output'  => PredisFile::NS_ROOT . '.php',
@@ -35,14 +38,17 @@ class CommandLine {
                 case 'source':
                 case 'source':
                     $options['source'] = $value;
                     $options['source'] = $value;
                     break;
                     break;
+
                 case 'o':
                 case 'o':
                 case 'output':
                 case 'output':
                     $options['output'] = $value;
                     $options['output'] = $value;
                     break;
                     break;
+
                 case 'E':
                 case 'E':
                 case 'exclude-classes':
                 case 'exclude-classes':
                     $options['exclude'] = @file($value, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: $value;
                     $options['exclude'] = @file($value, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: $value;
                     break;
                     break;
+
                 case 'e':
                 case 'e':
                 case 'exclude':
                 case 'exclude':
                     $options['exclude'] = is_array($value) ? $value : array($value);
                     $options['exclude'] = is_array($value) ? $value : array($value);
@@ -54,120 +60,151 @@ class CommandLine {
     }
     }
 }
 }
 
 
-class PredisFile {
+class PredisFile
+{
     const NS_ROOT = 'Predis';
     const NS_ROOT = 'Predis';
+
     private $_namespaces;
     private $_namespaces;
 
 
-    public function __construct() {
+    public function __construct()
+    {
         $this->_namespaces = array();
         $this->_namespaces = array();
     }
     }
 
 
-    public static function from($libraryPath, Array $exclude = array()) {
+    public static function from($libraryPath, Array $exclude = array())
+    {
         $nsroot = self::NS_ROOT;
         $nsroot = self::NS_ROOT;
         $predisFile = new PredisFile();
         $predisFile = new PredisFile();
         $libIterator = new RecursiveDirectoryIterator("$libraryPath$nsroot");
         $libIterator = new RecursiveDirectoryIterator("$libraryPath$nsroot");
 
 
-        foreach (new RecursiveIteratorIterator($libIterator) as $classFile) {
+        foreach (new RecursiveIteratorIterator($libIterator) as $classFile)
+        {
             if (!$classFile->isFile()) {
             if (!$classFile->isFile()) {
                 continue;
                 continue;
             }
             }
 
 
             $namespace = strtr(str_replace($libraryPath, '', $classFile->getPath()), '/', '\\');
             $namespace = strtr(str_replace($libraryPath, '', $classFile->getPath()), '/', '\\');
+
             if (in_array(sprintf('%s\\%s', $namespace, $classFile->getBasename('.php')), $exclude)) {
             if (in_array(sprintf('%s\\%s', $namespace, $classFile->getBasename('.php')), $exclude)) {
                 continue;
                 continue;
             }
             }
 
 
             $phpNamespace = $predisFile->getNamespace($namespace);
             $phpNamespace = $predisFile->getNamespace($namespace);
+
             if ($phpNamespace === false) {
             if ($phpNamespace === false) {
                 $phpNamespace = new PhpNamespace($namespace);
                 $phpNamespace = new PhpNamespace($namespace);
                 $predisFile->addNamespace($phpNamespace);
                 $predisFile->addNamespace($phpNamespace);
             }
             }
+
             $phpClass = new PhpClass($phpNamespace, $classFile);
             $phpClass = new PhpClass($phpNamespace, $classFile);
         }
         }
+
         return $predisFile;
         return $predisFile;
     }
     }
 
 
-    public function addNamespace(PhpNamespace $namespace) {
+    public function addNamespace(PhpNamespace $namespace)
+    {
         if (isset($this->_namespaces[(string)$namespace])) {
         if (isset($this->_namespaces[(string)$namespace])) {
             throw new InvalidArgumentException("Duplicated namespace");
             throw new InvalidArgumentException("Duplicated namespace");
         }
         }
         $this->_namespaces[(string)$namespace] = $namespace;
         $this->_namespaces[(string)$namespace] = $namespace;
     }
     }
 
 
-    public function getNamespaces() {
+    public function getNamespaces()
+    {
         return $this->_namespaces;
         return $this->_namespaces;
     }
     }
 
 
-    public function getNamespace($namespace) {
+    public function getNamespace($namespace)
+    {
         if (!isset($this->_namespaces[$namespace])) {
         if (!isset($this->_namespaces[$namespace])) {
             return false;
             return false;
         }
         }
+
         return $this->_namespaces[$namespace];
         return $this->_namespaces[$namespace];
     }
     }
 
 
-    public function getClassByFQN($classFqn) {
+    public function getClassByFQN($classFqn)
+    {
         if (($nsLastPos = strrpos($classFqn, '\\')) !== false) {
         if (($nsLastPos = strrpos($classFqn, '\\')) !== false) {
             $namespace = $this->getNamespace(substr($classFqn, 0, $nsLastPos));
             $namespace = $this->getNamespace(substr($classFqn, 0, $nsLastPos));
             if ($namespace === false) {
             if ($namespace === false) {
                 return null;
                 return null;
             }
             }
             $className = substr($classFqn, $nsLastPos + 1);
             $className = substr($classFqn, $nsLastPos + 1);
+
             return $namespace->getClass($className);
             return $namespace->getClass($className);
         }
         }
+
         return null;
         return null;
     }
     }
 
 
-    private function calculateDependencyScores(&$classes, $fqn) {
+    private function calculateDependencyScores(&$classes, $fqn)
+    {
         if (!isset($classes[$fqn])) {
         if (!isset($classes[$fqn])) {
             $classes[$fqn] = 0;
             $classes[$fqn] = 0;
         }
         }
+
         $classes[$fqn] += 1;
         $classes[$fqn] += 1;
+
         if (($phpClass = $this->getClassByFQN($fqn)) === null) {
         if (($phpClass = $this->getClassByFQN($fqn)) === null) {
-            throw new RuntimeException("Cannot found the class $fqn which is required by other subclasses. Are you missing a file?");
+            throw new RuntimeException(
+                "Cannot found the class $fqn which is required by other subclasses. Are you missing a file?"
+            );
         }
         }
+
         foreach ($phpClass->getDependencies() as $fqn) {
         foreach ($phpClass->getDependencies() as $fqn) {
             $this->calculateDependencyScores($classes, $fqn);
             $this->calculateDependencyScores($classes, $fqn);
         }
         }
     }
     }
 
 
-    private function getDependencyScores() {
+    private function getDependencyScores()
+    {
         $classes = array();
         $classes = array();
+
         foreach ($this->getNamespaces() as $phpNamespace) {
         foreach ($this->getNamespaces() as $phpNamespace) {
             foreach ($phpNamespace->getClasses() as $phpClass) {
             foreach ($phpNamespace->getClasses() as $phpClass) {
                 $this->calculateDependencyScores($classes, $phpClass->getFQN());
                 $this->calculateDependencyScores($classes, $phpClass->getFQN());
             }
             }
         }
         }
+
         return $classes;
         return $classes;
     }
     }
 
 
-    private function getOrderedNamespaces($dependencyScores) {
+    private function getOrderedNamespaces($dependencyScores)
+    {
         $namespaces = array_fill_keys(array_unique(
         $namespaces = array_fill_keys(array_unique(
             array_map(
             array_map(
                 function($fqn) { return PhpNamespace::extractName($fqn); },
                 function($fqn) { return PhpNamespace::extractName($fqn); },
                 array_keys($dependencyScores)
                 array_keys($dependencyScores)
             )
             )
         ), 0);
         ), 0);
+
         foreach ($dependencyScores as $classFqn => $score) {
         foreach ($dependencyScores as $classFqn => $score) {
             $namespaces[PhpNamespace::extractName($classFqn)] += $score;
             $namespaces[PhpNamespace::extractName($classFqn)] += $score;
         }
         }
+
         arsort($namespaces);
         arsort($namespaces);
+
         return array_keys($namespaces);
         return array_keys($namespaces);
     }
     }
 
 
-    private function getOrderedClasses(PhpNamespace $phpNamespace, $classes) {
-        $nsClassesFQNs = array_map(
-            function($cl) { return $cl->getFQN(); },
-            $phpNamespace->getClasses()
-        );
+    private function getOrderedClasses(PhpNamespace $phpNamespace, $classes)
+    {
+        $nsClassesFQNs = array_map(function($cl) { return $cl->getFQN(); }, $phpNamespace->getClasses());
         $nsOrderedClasses = array();
         $nsOrderedClasses = array();
+
         foreach ($nsClassesFQNs as $nsClassFQN) {
         foreach ($nsClassesFQNs as $nsClassFQN) {
             $nsOrderedClasses[$nsClassFQN] = $classes[$nsClassFQN];
             $nsOrderedClasses[$nsClassFQN] = $classes[$nsClassFQN];
         }
         }
+
         arsort($nsOrderedClasses);
         arsort($nsOrderedClasses);
+
         return array_keys($nsOrderedClasses);
         return array_keys($nsOrderedClasses);
     }
     }
 
 
-    public function getPhpCode() {
+    public function getPhpCode()
+    {
         $buffer = array("<?php\n\n");
         $buffer = array("<?php\n\n");
         $classes = $this->getDependencyScores();
         $classes = $this->getDependencyScores();
         $namespaces = $this->getOrderedNamespaces($classes);
         $namespaces = $this->getOrderedNamespaces($classes);
@@ -196,10 +233,12 @@ class PredisFile {
             $buffer[] = "/* " . str_repeat("-", 75) . " */";
             $buffer[] = "/* " . str_repeat("-", 75) . " */";
             $buffer[] = "\n\n";
             $buffer[] = "\n\n";
         }
         }
+
         return implode($buffer);
         return implode($buffer);
     }
     }
 
 
-    public function saveTo($outputFile) {
+    public function saveTo($outputFile)
+    {
         // TODO: add more sanity checks
         // TODO: add more sanity checks
         if ($outputFile === null || $outputFile === '') {
         if ($outputFile === null || $outputFile === '') {
             throw new InvalidArgumentException('You must specify a valid output file');
             throw new InvalidArgumentException('You must specify a valid output file');
@@ -208,127 +247,167 @@ class PredisFile {
     }
     }
 }
 }
 
 
-class PhpNamespace implements IteratorAggregate {
-    private $_namespace, $_classes;
+class PhpNamespace implements IteratorAggregate
+{
+    private $_namespace;
+    private $_classes;
 
 
-    public function __construct($namespace) {
+    public function __construct($namespace)
+    {
         $this->_namespace = $namespace;
         $this->_namespace = $namespace;
         $this->_classes = array();
         $this->_classes = array();
         $this->_useDirectives = new PhpUseDirectives($this);
         $this->_useDirectives = new PhpUseDirectives($this);
     }
     }
 
 
-    public static function extractName($fqn) {
+    public static function extractName($fqn)
+    {
         $nsSepLast = strrpos($fqn, '\\');
         $nsSepLast = strrpos($fqn, '\\');
         if ($nsSepLast === false) {
         if ($nsSepLast === false) {
             return $fqn;
             return $fqn;
         }
         }
         $ns = substr($fqn, 0, $nsSepLast);
         $ns = substr($fqn, 0, $nsSepLast);
+
         return $ns !== '' ? $ns : null;
         return $ns !== '' ? $ns : null;
     }
     }
 
 
-    public function addClass(PhpClass $class) {
+    public function addClass(PhpClass $class)
+    {
         $this->_classes[$class->getName()] = $class;
         $this->_classes[$class->getName()] = $class;
     }
     }
 
 
-    public function getClass($className) {
+    public function getClass($className)
+    {
         if (isset($this->_classes[$className])) {
         if (isset($this->_classes[$className])) {
             return $this->_classes[$className];
             return $this->_classes[$className];
         }
         }
     }
     }
 
 
-    public function getClasses() {
+    public function getClasses()
+    {
         return array_values($this->_classes);
         return array_values($this->_classes);
     }
     }
 
 
-    public function getIterator() {
+    public function getIterator()
+    {
         return new \ArrayIterator($this->getClasses());
         return new \ArrayIterator($this->getClasses());
     }
     }
 
 
-    public function getUseDirectives() {
+    public function getUseDirectives()
+    {
         return $this->_useDirectives;
         return $this->_useDirectives;
     }
     }
 
 
-    public function getPhpCode() {
+    public function getPhpCode()
+    {
         return "namespace $this->_namespace;\n";
         return "namespace $this->_namespace;\n";
     }
     }
 
 
-    public function __toString() {
+    public function __toString()
+    {
         return $this->_namespace;
         return $this->_namespace;
     }
     }
 }
 }
 
 
-class PhpUseDirectives implements Countable, IteratorAggregate {
-    private $_use, $_aliases, $_namespace;
+class PhpUseDirectives implements Countable, IteratorAggregate
+{
+    private $_use;
+    private $_aliases;
+    private $_namespace;
 
 
-    public function __construct(PhpNamespace $namespace) {
+    public function __construct(PhpNamespace $namespace)
+    {
         $this->_use = array();
         $this->_use = array();
         $this->_aliases = array();
         $this->_aliases = array();
         $this->_namespace = $namespace;
         $this->_namespace = $namespace;
     }
     }
 
 
-    public function add($use, $as = null) {
-        if (!in_array($use, $this->_use)) {
-            $this->_use[] = $use;
-            $this->_aliases[$as ?: PhpClass::extractName($use)] = $use;
+    public function add($use, $as = null)
+    {
+        if (in_array($use, $this->_use)) {
+            return;
         }
         }
+
+        $this->_use[] = $use;
+        $this->_aliases[$as ?: PhpClass::extractName($use)] = $use;
     }
     }
 
 
-    public function getList() {
+    public function getList()
+    {
         return $this->_use;
         return $this->_use;
     }
     }
 
 
-    public function getIterator() {
+    public function getIterator()
+    {
         return new \ArrayIterator($this->getList());
         return new \ArrayIterator($this->getList());
     }
     }
 
 
-    public function getPhpCode() {
+    public function getPhpCode()
+    {
         $reducer = function($str, $use) { return $str .= "use $use;\n"; };
         $reducer = function($str, $use) { return $str .= "use $use;\n"; };
+
         return array_reduce($this->getList(), $reducer, '');
         return array_reduce($this->getList(), $reducer, '');
     }
     }
 
 
-    public function getNamespace() {
+    public function getNamespace()
+    {
         return $this->_namespace;
         return $this->_namespace;
     }
     }
 
 
-    public function getFQN($className) {
+    public function getFQN($className)
+    {
         if (($nsSepFirst = strpos($className, '\\')) === false) {
         if (($nsSepFirst = strpos($className, '\\')) === false) {
             if (isset($this->_aliases[$className])) {
             if (isset($this->_aliases[$className])) {
                 return $this->_aliases[$className];
                 return $this->_aliases[$className];
             }
             }
+
             return (string)$this->getNamespace() . "\\$className";
             return (string)$this->getNamespace() . "\\$className";
         }
         }
+
         if ($nsSepFirst != 0) {
         if ($nsSepFirst != 0) {
             throw new InvalidArgumentException("Partially qualified names are not supported");
             throw new InvalidArgumentException("Partially qualified names are not supported");
         }
         }
+
         return $className;
         return $className;
     }
     }
 
 
-    public function count() {
+    public function count()
+    {
         return count($this->_use);
         return count($this->_use);
     }
     }
 }
 }
 
 
-class PhpClass {
-    private $_namespace, $_file, $_body, $_implements, $_extends, $_name;
-
-    public function __construct(PhpNamespace $namespace, SplFileInfo $classFile) {
+class PhpClass
+{
+    private $_namespace;
+    private $_file;
+    private $_body;
+    private $_implements;
+    private $_extends;
+    private $_name;
+
+    public function __construct(PhpNamespace $namespace, SplFileInfo $classFile)
+    {
         $this->_namespace = $namespace;
         $this->_namespace = $namespace;
         $this->_file = $classFile;
         $this->_file = $classFile;
         $this->_implements = array();
         $this->_implements = array();
         $this->_extends = array();
         $this->_extends = array();
+
         $this->extractData();
         $this->extractData();
         $namespace->addClass($this);
         $namespace->addClass($this);
     }
     }
 
 
-    public static function extractName($fqn) {
+    public static function extractName($fqn)
+    {
         $nsSepLast = strrpos($fqn, '\\');
         $nsSepLast = strrpos($fqn, '\\');
         if ($nsSepLast === false) {
         if ($nsSepLast === false) {
             return $fqn;
             return $fqn;
         }
         }
+
         return substr($fqn, $nsSepLast + 1);
         return substr($fqn, $nsSepLast + 1);
     }
     }
 
 
-    private function extractData() {
+    private function extractData()
+    {
         $useDirectives = $this->getNamespace()->getUseDirectives();
         $useDirectives = $this->getNamespace()->getUseDirectives();
 
 
         $useExtractor = function($m) use($useDirectives) {
         $useExtractor = function($m) use($useDirectives) {
@@ -347,15 +426,18 @@ class PhpClass {
         $this->extractHierarchy();
         $this->extractHierarchy();
     }
     }
 
 
-    private function extractHierarchy() {
+    private function extractHierarchy()
+    {
         $implements = array();
         $implements = array();
         $extends =  array();
         $extends =  array();
 
 
         $extractor = function($iterator, $callback) {
         $extractor = function($iterator, $callback) {
             $className = '';
             $className = '';
             $iterator->seek($iterator->key() + 1);
             $iterator->seek($iterator->key() + 1);
+
             while ($iterator->valid()) {
             while ($iterator->valid()) {
                 $token = $iterator->current();
                 $token = $iterator->current();
+
                 if (is_string($token)) {
                 if (is_string($token)) {
                     if (preg_match('/\s?,\s?/', $token)) {
                     if (preg_match('/\s?,\s?/', $token)) {
                         $callback(trim($className));
                         $callback(trim($className));
@@ -366,26 +448,30 @@ class PhpClass {
                         return;
                         return;
                     }
                     }
                 }
                 }
+
                 switch ($token[0]) {
                 switch ($token[0]) {
                     case T_NS_SEPARATOR:
                     case T_NS_SEPARATOR:
                         $className .= '\\';
                         $className .= '\\';
                         break;
                         break;
+
                     case T_STRING:
                     case T_STRING:
                         $className .= $token[1];
                         $className .= $token[1];
                         break;
                         break;
+
                     case T_IMPLEMENTS:
                     case T_IMPLEMENTS:
                     case T_EXTENDS:
                     case T_EXTENDS:
                         $callback(trim($className));
                         $callback(trim($className));
                         $iterator->seek($iterator->key() - 1);
                         $iterator->seek($iterator->key() - 1);
                         return;
                         return;
                 }
                 }
+
                 $iterator->next();
                 $iterator->next();
             }
             }
         };
         };
 
 
         $tokens = token_get_all("<?php\n" . trim($this->getPhpCode()));
         $tokens = token_get_all("<?php\n" . trim($this->getPhpCode()));
-
         $iterator = new ArrayIterator($tokens);
         $iterator = new ArrayIterator($tokens);
+
         while ($iterator->valid()) {
         while ($iterator->valid()) {
             $token = $iterator->current();
             $token = $iterator->current();
             if (is_string($token)) {
             if (is_string($token)) {
@@ -400,17 +486,20 @@ class PhpClass {
                     $tk = $iterator->current();
                     $tk = $iterator->current();
                     $this->_name = $tk[1];
                     $this->_name = $tk[1];
                     break;
                     break;
+
                 case T_IMPLEMENTS:
                 case T_IMPLEMENTS:
                     $extractor($iterator, function($fqn) use (&$implements) {
                     $extractor($iterator, function($fqn) use (&$implements) {
                         $implements[] = $fqn;
                         $implements[] = $fqn;
                     });
                     });
                     break;
                     break;
+
                 case T_EXTENDS:
                 case T_EXTENDS:
                     $extractor($iterator, function($fqn) use (&$extends) {
                     $extractor($iterator, function($fqn) use (&$extends) {
                         $extends[] = $fqn;
                         $extends[] = $fqn;
                     });
                     });
                     break;
                     break;
             }
             }
+
             $iterator->next();
             $iterator->next();
         }
         }
 
 
@@ -418,63 +507,71 @@ class PhpClass {
         $this->_extends = $this->guessFQN($extends);
         $this->_extends = $this->guessFQN($extends);
     }
     }
 
 
-    public function guessFQN($classes) {
+    public function guessFQN($classes)
+    {
         $useDirectives = $this->getNamespace()->getUseDirectives();
         $useDirectives = $this->getNamespace()->getUseDirectives();
         return array_map(array($useDirectives, 'getFQN'), $classes);
         return array_map(array($useDirectives, 'getFQN'), $classes);
     }
     }
 
 
-    public function getImplementedInterfaces($all = false) {
+    public function getImplementedInterfaces($all = false)
+    {
         if ($all) {
         if ($all) {
             return $this->_implements;
             return $this->_implements;
         }
         }
-        else {
-            return array_filter(
-                $this->_implements,
-                function ($cn) { return strpos($cn, 'Predis\\') === 0; }
-            );
-        }
+
+        return array_filter(
+            $this->_implements,
+            function ($cn) { return strpos($cn, 'Predis\\') === 0; }
+        );
     }
     }
 
 
-    public function getExtendedClasses($all = false) {
+    public function getExtendedClasses($all = false)
+    {
         if ($all) {
         if ($all) {
             return $this->_extemds;
             return $this->_extemds;
         }
         }
-        else {
-            return array_filter(
-                $this->_extends,
-                function ($cn) { return strpos($cn, 'Predis\\') === 0; }
-            );
-        }
+
+        return array_filter(
+            $this->_extends,
+            function ($cn) { return strpos($cn, 'Predis\\') === 0; }
+        );
     }
     }
 
 
-    public function getDependencies($all = false) {
+    public function getDependencies($all = false)
+    {
         return array_merge(
         return array_merge(
             $this->getImplementedInterfaces($all),
             $this->getImplementedInterfaces($all),
             $this->getExtendedClasses($all)
             $this->getExtendedClasses($all)
         );
         );
     }
     }
 
 
-    public function getNamespace() {
+    public function getNamespace()
+    {
         return $this->_namespace;
         return $this->_namespace;
     }
     }
 
 
-    public function getFile() {
+    public function getFile()
+    {
         return $this->_file;
         return $this->_file;
     }
     }
 
 
-    public function getName() {
+    public function getName()
+    {
         return $this->_name;
         return $this->_name;
     }
     }
 
 
-    public function getFQN() {
+    public function getFQN()
+    {
         return (string)$this->getNamespace() . '\\' . $this->_name;
         return (string)$this->getNamespace() . '\\' . $this->_name;
     }
     }
 
 
-    public function getPhpCode() {
+    public function getPhpCode()
+    {
         return $this->_body;
         return $this->_body;
     }
     }
 
 
-    public function __toString() {
+    public function __toString()
+    {
         return "class " . $this->getName() . '{ ... }';
         return "class " . $this->getName() . '{ ... }';
     }
     }
 }
 }

+ 16 - 7
examples/CustomDistributionStrategy.php

@@ -9,35 +9,44 @@ require 'SharedConfigurations.php';
 use Predis\Distribution\IDistributionStrategy;
 use Predis\Distribution\IDistributionStrategy;
 use Predis\Network\PredisCluster;
 use Predis\Network\PredisCluster;
 
 
-class NaiveDistributionStrategy implements IDistributionStrategy {
-    private $_nodes, $_nodesCount;
+class NaiveDistributionStrategy implements IDistributionStrategy
+{
+    private $_nodes;
+    private $_nodesCount;
 
 
-    public function __constructor() {
+    public function __constructor()
+    {
         $this->_nodes = array();
         $this->_nodes = array();
         $this->_nodesCount = 0;
         $this->_nodesCount = 0;
     }
     }
 
 
-    public function add($node, $weight = null) {
+    public function add($node, $weight = null)
+    {
         $this->_nodes[] = $node;
         $this->_nodes[] = $node;
         $this->_nodesCount++;
         $this->_nodesCount++;
     }
     }
 
 
-    public function remove($node) {
+    public function remove($node)
+    {
         $this->_nodes = array_filter($this->_nodes, function($n) use($node) {
         $this->_nodes = array_filter($this->_nodes, function($n) use($node) {
             return $n !== $node;
             return $n !== $node;
         });
         });
+
         $this->_nodesCount = count($this->_nodes);
         $this->_nodesCount = count($this->_nodes);
     }
     }
 
 
-    public function get($key) {
+    public function get($key)
+    {
         $count = $this->_nodesCount;
         $count = $this->_nodesCount;
         if ($count === 0) {
         if ($count === 0) {
             throw new RuntimeException('No connections');
             throw new RuntimeException('No connections');
         }
         }
+
         return $this->_nodes[$count > 1 ? abs(crc32($key) % $count) : 0];
         return $this->_nodes[$count > 1 ? abs(crc32($key) % $count) : 0];
     }
     }
 
 
-    public function generateKey($value) {
+    public function generateKey($value)
+    {
         return crc32($value);
         return crc32($value);
     }
     }
 }
 }

+ 10 - 5
examples/DispatcherLoop.php

@@ -22,22 +22,27 @@ $client = new Predis\Client($single_server + array('read_write_timeout' => 0));
 $dispatcher = new Predis\DispatcherLoop($client);
 $dispatcher = new Predis\DispatcherLoop($client);
 
 
 // Demonstrate how to use a callable class as a callback for Predis\DispatcherLoop.
 // Demonstrate how to use a callable class as a callback for Predis\DispatcherLoop.
-class EventsListener implements Countable {
+class EventsListener implements Countable
+{
     private $_events;
     private $_events;
 
 
-    public function __construct() {
+    public function __construct()
+    {
         $this->_events = array();
         $this->_events = array();
     }
     }
 
 
-    public function count() {
+    public function count()
+    {
         return count($this->_events);
         return count($this->_events);
     }
     }
 
 
-    public function getEvents() {
+    public function getEvents()
+    {
         return $this->_events;
         return $this->_events;
     }
     }
 
 
-    public function __invoke($payload) {
+    public function __invoke($payload)
+    {
         $this->_events[] = $payload;
         $this->_events[] = $payload;
     }
     }
 }
 }

+ 14 - 11
examples/MultiExecTransactionsWithCAS.php

@@ -16,26 +16,29 @@ ZADD zset 2 b
 ZADD zset 3 c
 ZADD zset 3 c
 */
 */
 
 
-function zpop($client, $zsetKey) {
+function zpop($client, $key)
+{
     $element = null;
     $element = null;
+
     $options = array(
     $options = array(
-        'cas'   => true,     // Initialize with support for CAS operations
-        'watch' => $zsetKey, // Key that needs to be WATCHed to detect changes
-        'retry' => 3,        // Number of retries on aborted transactions, after
-                             // which the client bails out with an exception.
+        'cas'   => true,    // Initialize with support for CAS operations
+        'watch' => $key,    // Key that needs to be WATCHed to detect changes
+        'retry' => 3,       // Number of retries on aborted transactions, after
+                            // which the client bails out with an exception.
     );
     );
 
 
-    $txReply = $client->multiExec($options, function($tx)
-        use ($zsetKey, &$element) {
-        @list($element) = $tx->zrange($zsetKey, 0, 0);
+    $txReply = $client->multiExec($options, function($tx) use ($key, &$element) {
+        @list($element) = $tx->zrange($key, 0, 0);
+
         if (isset($element)) {
         if (isset($element)) {
-            $tx->multi();     // With CAS, MULTI *must* be explicitly invoked.
-            $tx->zrem($zsetKey, $element);
+            $tx->multi();   // With CAS, MULTI *must* be explicitly invoked.
+            $tx->zrem($key, $element);
         }
         }
     });
     });
     return $element;
     return $element;
 }
 }
 
 
-$redis = new Predis\Client($single_server, 'dev');
+$redis = new Predis\Client($single_server);
 $zpopped = zpop($redis, 'zset');
 $zpopped = zpop($redis, 'zset');
+
 echo isset($zpopped) ? "ZPOPed $zpopped" : "Nothing to ZPOP!", "\n";
 echo isset($zpopped) ? "ZPOPed $zpopped" : "Nothing to ZPOP!", "\n";

+ 1 - 0
examples/PubSubContext.php

@@ -23,6 +23,7 @@ foreach ($pubsub as $message) {
         case 'subscribe':
         case 'subscribe':
             echo "Subscribed to {$message->channel}\n";
             echo "Subscribed to {$message->channel}\n";
             break;
             break;
+
         case 'message':
         case 'message':
             if ($message->channel == 'control_channel') {
             if ($message->channel == 'control_channel') {
                 if ($message->payload == 'quit_loop') {
                 if ($message->payload == 'quit_loop') {

+ 8 - 3
examples/ServerSideScripting.php

@@ -9,12 +9,15 @@ require 'SharedConfigurations.php';
 
 
 use Predis\Commands\ScriptedCommand;
 use Predis\Commands\ScriptedCommand;
 
 
-class IncrementExistingKey extends ScriptedCommand {
-    protected function keysCount() {
+class IncrementExistingKey extends ScriptedCommand
+{
+    protected function keysCount()
+    {
         return 1;
         return 1;
     }
     }
 
 
-    public function getScript() {
+    public function getScript()
+    {
         return
         return
 <<<LUA
 <<<LUA
     if redis('exists', KEYS[1]) == 1 then
     if redis('exists', KEYS[1]) == 1 then
@@ -25,8 +28,10 @@ LUA;
 }
 }
 
 
 $client = new Predis\Client($single_server, 'dev');
 $client = new Predis\Client($single_server, 'dev');
+
 $client->getProfile()->defineCommand('increx', 'IncrementExistingKey');
 $client->getProfile()->defineCommand('increx', 'IncrementExistingKey');
 
 
 $client->set('foo', 10);
 $client->set('foo', 10);
+
 var_dump($client->increx('foo'));       // int(11)
 var_dump($client->increx('foo'));       // int(11)
 var_dump($client->increx('bar'));       // NULL
 var_dump($client->increx('bar'));       // NULL

+ 18 - 7
examples/SimpleDebuggableConnection.php

@@ -6,37 +6,48 @@ use Predis\ConnectionParameters;
 use Predis\Commands\ICommand;
 use Predis\Commands\ICommand;
 use Predis\Network\StreamConnection;
 use Predis\Network\StreamConnection;
 
 
-class SimpleDebuggableConnection extends StreamConnection {
-    private $_debugBuffer = array();
+class SimpleDebuggableConnection extends StreamConnection
+{
     private $_tstart = 0;
     private $_tstart = 0;
+    private $_debugBuffer = array();
 
 
-    public function connect() {
+    public function connect()
+    {
         $this->_tstart = microtime(true);
         $this->_tstart = microtime(true);
+
         parent::connect();
         parent::connect();
     }
     }
 
 
-    private function storeDebug(ICommand $command, $direction) {
+    private function storeDebug(ICommand $command, $direction)
+    {
         $firtsArg  = $command->getArgument(0);
         $firtsArg  = $command->getArgument(0);
         $timestamp = round(microtime(true) - $this->_tstart, 4);
         $timestamp = round(microtime(true) - $this->_tstart, 4);
+
         $debug  = $command->getId();
         $debug  = $command->getId();
         $debug .= isset($firtsArg) ? " $firtsArg " : ' ';
         $debug .= isset($firtsArg) ? " $firtsArg " : ' ';
         $debug .= "$direction $this";
         $debug .= "$direction $this";
         $debug .= " [{$timestamp}s]";
         $debug .= " [{$timestamp}s]";
+
         $this->_debugBuffer[] = $debug;
         $this->_debugBuffer[] = $debug;
     }
     }
 
 
-    public function writeCommand(ICommand $command) {
+    public function writeCommand(ICommand $command)
+    {
         parent::writeCommand($command);
         parent::writeCommand($command);
+
         $this->storeDebug($command, '->');
         $this->storeDebug($command, '->');
     }
     }
 
 
-    public function readResponse(ICommand $command) {
+    public function readResponse(ICommand $command)
+    {
         $reply = parent::readResponse($command);
         $reply = parent::readResponse($command);
         $this->storeDebug($command, '<-');
         $this->storeDebug($command, '<-');
+
         return $reply;
         return $reply;
     }
     }
 
 
-    public function getDebugBuffer() {
+    public function getDebugBuffer()
+    {
         return $this->_debugBuffer;
         return $this->_debugBuffer;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Autoloader.php

@@ -2,20 +2,24 @@
 
 
 namespace Predis;
 namespace Predis;
 
 
-class Autoloader {
+class Autoloader
+{
     private $base_directory;
     private $base_directory;
     private $prefix;
     private $prefix;
 
 
-    public function __construct($base_directory=NULL) {
+    public function __construct($base_directory = null)
+    {
         $this->base_directory = $base_directory ?: dirname(__FILE__);
         $this->base_directory = $base_directory ?: dirname(__FILE__);
         $this->prefix = __NAMESPACE__ . '\\';
         $this->prefix = __NAMESPACE__ . '\\';
     }
     }
 
 
-    public static function register() {
+    public static function register()
+    {
         spl_autoload_register(array(new self, 'autoload'));
         spl_autoload_register(array(new self, 'autoload'));
     }
     }
 
 
-    public function autoload($class_name) {
+    public function autoload($class_name)
+    {
         if (0 !== strpos($class_name, $this->prefix)) {
         if (0 !== strpos($class_name, $this->prefix)) {
             return;
             return;
         }
         }

+ 87 - 48
lib/Predis/Client.php

@@ -15,142 +15,169 @@ class Client {
 
 
     private $_options;
     private $_options;
     private $_profile;
     private $_profile;
-    private $_connectionFactory;
     private $_connection;
     private $_connection;
+    private $_connectionFactory;
 
 
-    public function __construct($parameters = null, $options = null) {
+    public function __construct($parameters = null, $options = null)
+    {
         $options = $this->filterOptions($options);
         $options = $this->filterOptions($options);
         $profile = $options->profile;
         $profile = $options->profile;
+
         if (isset($options->prefix)) {
         if (isset($options->prefix)) {
             $profile->setProcessor($options->prefix);
             $profile->setProcessor($options->prefix);
         }
         }
+
         $this->_options = $options;
         $this->_options = $options;
         $this->_profile = $profile;
         $this->_profile = $profile;
         $this->_connectionFactory = $options->connections;
         $this->_connectionFactory = $options->connections;
         $this->_connection = $this->initializeConnection($parameters);
         $this->_connection = $this->initializeConnection($parameters);
     }
     }
 
 
-    private function filterOptions($options) {
+    private function filterOptions($options)
+    {
         if ($options === null) {
         if ($options === null) {
             return new ClientOptions();
             return new ClientOptions();
         }
         }
+
         if (is_array($options)) {
         if (is_array($options)) {
             return new ClientOptions($options);
             return new ClientOptions($options);
         }
         }
+
         if ($options instanceof ClientOptions) {
         if ($options instanceof ClientOptions) {
             return $options;
             return $options;
         }
         }
+
         if ($options instanceof IServerProfile) {
         if ($options instanceof IServerProfile) {
             return new ClientOptions(array('profile' => $options));
             return new ClientOptions(array('profile' => $options));
         }
         }
+
         if (is_string($options)) {
         if (is_string($options)) {
             return new ClientOptions(array('profile' => ServerProfile::get($options)));
             return new ClientOptions(array('profile' => ServerProfile::get($options)));
         }
         }
+
         throw new \InvalidArgumentException("Invalid type for client options");
         throw new \InvalidArgumentException("Invalid type for client options");
     }
     }
 
 
-    private function initializeConnection($parameters) {
+    private function initializeConnection($parameters)
+    {
         if ($parameters === null) {
         if ($parameters === null) {
             return $this->createConnection(new ConnectionParameters());
             return $this->createConnection(new ConnectionParameters());
         }
         }
+
         if (is_array($parameters)) {
         if (is_array($parameters)) {
             if (isset($parameters[0])) {
             if (isset($parameters[0])) {
                 $cluster = $this->_options->cluster;
                 $cluster = $this->_options->cluster;
-                foreach ($parameters as $single) {
-                    $cluster->add($single instanceof IConnectionSingle
-                        ? $single : $this->createConnection($single)
-                    );
+                foreach ($parameters as $node) {
+                    $connection = $node instanceof IConnectionSingle ? $node : $this->createConnection($node);
+                    $cluster->add($connection);
                 }
                 }
                 return $cluster;
                 return $cluster;
             }
             }
             return $this->createConnection($parameters);
             return $this->createConnection($parameters);
         }
         }
+
         if ($parameters instanceof IConnection) {
         if ($parameters instanceof IConnection) {
             return $parameters;
             return $parameters;
         }
         }
+
         return $this->createConnection($parameters);
         return $this->createConnection($parameters);
     }
     }
 
 
-    protected function createConnection($parameters) {
+    protected function createConnection($parameters)
+    {
         $connection = $this->_connectionFactory->create($parameters);
         $connection = $this->_connectionFactory->create($parameters);
         $parameters = $connection->getParameters();
         $parameters = $connection->getParameters();
+
         if (isset($parameters->password)) {
         if (isset($parameters->password)) {
-            $connection->pushInitCommand(
-                $this->createCommand('auth', array($parameters->password))
-            );
+            $command = $this->createCommand('auth', array($parameters->password));
+            $connection->pushInitCommand($command);
         }
         }
+
         if (isset($parameters->database)) {
         if (isset($parameters->database)) {
-            $connection->pushInitCommand(
-                $this->createCommand('select', array($parameters->database))
-            );
+            $command = $this->createCommand('select', array($parameters->database));
+            $connection->pushInitCommand($command);
         }
         }
+
         return $connection;
         return $connection;
     }
     }
 
 
-    public function getProfile() {
+    public function getProfile()
+    {
         return $this->_profile;
         return $this->_profile;
     }
     }
 
 
-    public function getOptions() {
+    public function getOptions()
+    {
         return $this->_options;
         return $this->_options;
     }
     }
 
 
-    public function getConnectionFactory() {
+    public function getConnectionFactory()
+    {
         return $this->_connectionFactory;
         return $this->_connectionFactory;
     }
     }
 
 
-    public function getClientFor($connectionAlias) {
+    public function getClientFor($connectionAlias)
+    {
         if (($connection = $this->getConnection($connectionAlias)) === null) {
         if (($connection = $this->getConnection($connectionAlias)) === null) {
-            throw new \InvalidArgumentException(
-                "Invalid connection alias: '$connectionAlias'"
-            );
+            throw new \InvalidArgumentException("Invalid connection alias: '$connectionAlias'");
         }
         }
+
         return new Client($connection, $this->_options);
         return new Client($connection, $this->_options);
     }
     }
 
 
-    public function connect() {
+    public function connect()
+    {
         $this->_connection->connect();
         $this->_connection->connect();
     }
     }
 
 
-    public function disconnect() {
+    public function disconnect()
+    {
         $this->_connection->disconnect();
         $this->_connection->disconnect();
     }
     }
 
 
-    public function quit() {
+    public function quit()
+    {
         $this->disconnect();
         $this->disconnect();
     }
     }
 
 
-    public function isConnected() {
+    public function isConnected()
+    {
         return $this->_connection->isConnected();
         return $this->_connection->isConnected();
     }
     }
 
 
-    public function getConnection($id = null) {
+    public function getConnection($id = null)
+    {
         if (isset($id)) {
         if (isset($id)) {
             if (!Helpers::isCluster($this->_connection)) {
             if (!Helpers::isCluster($this->_connection)) {
                 throw new ClientException(
                 throw new ClientException(
-                    'Retrieving connections by alias is supported '.
-                    'only with clustered connections'
+                    'Retrieving connections by alias is supported only with clustered connections'
                 );
                 );
             }
             }
+
             return $this->_connection->getConnectionById($id);
             return $this->_connection->getConnectionById($id);
         }
         }
+
         return $this->_connection;
         return $this->_connection;
     }
     }
 
 
-    public function __call($method, $arguments) {
+    public function __call($method, $arguments)
+    {
         $command = $this->_profile->createCommand($method, $arguments);
         $command = $this->_profile->createCommand($method, $arguments);
         return $this->_connection->executeCommand($command);
         return $this->_connection->executeCommand($command);
     }
     }
 
 
-    public function createCommand($method, $arguments = array()) {
+    public function createCommand($method, $arguments = array())
+    {
         return $this->_profile->createCommand($method, $arguments);
         return $this->_profile->createCommand($method, $arguments);
     }
     }
 
 
-    public function executeCommand(ICommand $command) {
+    public function executeCommand(ICommand $command)
+    {
         return $this->_connection->executeCommand($command);
         return $this->_connection->executeCommand($command);
     }
     }
 
 
-    public function executeCommandOnShards(ICommand $command) {
+    public function executeCommandOnShards(ICommand $command)
+    {
         if (Helpers::isCluster($this->_connection)) {
         if (Helpers::isCluster($this->_connection)) {
             $replies = array();
             $replies = array();
             foreach ($this->_connection as $connection) {
             foreach ($this->_connection as $connection) {
@@ -158,58 +185,69 @@ class Client {
             }
             }
             return $replies;
             return $replies;
         }
         }
+
         return array($this->_connection->executeCommand($command));
         return array($this->_connection->executeCommand($command));
     }
     }
 
 
-    private function sharedInitializer($argv, $initializer) {
+    private function sharedInitializer($argv, $initializer)
+    {
         switch (count($argv)) {
         switch (count($argv)) {
             case 0:
             case 0:
                 return $this->$initializer();
                 return $this->$initializer();
+
             case 1:
             case 1:
                 list($arg0) = $argv;
                 list($arg0) = $argv;
-                return is_array($arg0)
-                    ? $this->$initializer($arg0)
-                    : $this->$initializer(null, $arg0);
+                return is_array($arg0) ? $this->$initializer($arg0) : $this->$initializer(null, $arg0);
+
             case 2:
             case 2:
                 list($arg0, $arg1) = $argv;
                 list($arg0, $arg1) = $argv;
                 return $this->$initializer($arg0, $arg1);
                 return $this->$initializer($arg0, $arg1);
+
             default:
             default:
                 return $this->$initializer($this, $argv);
                 return $this->$initializer($this, $argv);
         }
         }
     }
     }
 
 
-    public function pipeline(/* arguments */) {
+    public function pipeline(/* arguments */)
+    {
         return $this->sharedInitializer(func_get_args(), 'initPipeline');
         return $this->sharedInitializer(func_get_args(), 'initPipeline');
     }
     }
 
 
-    protected function initPipeline(Array $options = null, $pipelineBlock = null) {
-        return $this->pipelineExecute(
-            new PipelineContext($this, $options), $pipelineBlock
-        );
+    protected function initPipeline(Array $options = null, $pipelineBlock = null)
+    {
+        $pipeline = new PipelineContext($this, $options);
+        return $this->pipelineExecute($pipeline, $pipelineBlock);
     }
     }
 
 
-    private function pipelineExecute(PipelineContext $pipeline, $block) {
+    private function pipelineExecute(PipelineContext $pipeline, $block)
+    {
         return $block !== null ? $pipeline->execute($block) : $pipeline;
         return $block !== null ? $pipeline->execute($block) : $pipeline;
     }
     }
 
 
-    public function multiExec(/* arguments */) {
+    public function multiExec(/* arguments */)
+    {
         return $this->sharedInitializer(func_get_args(), 'initMultiExec');
         return $this->sharedInitializer(func_get_args(), 'initMultiExec');
     }
     }
 
 
-    protected function initMultiExec(Array $options = null, $block = null) {
+    protected function initMultiExec(Array $options = null, $block = null)
+    {
         $transaction = new MultiExecContext($this, $options ?: array());
         $transaction = new MultiExecContext($this, $options ?: array());
         return isset($block) ? $transaction->execute($block) : $transaction;
         return isset($block) ? $transaction->execute($block) : $transaction;
     }
     }
 
 
-    public function pubSub(/* arguments */) {
+    public function pubSub(/* arguments */)
+    {
         return $this->sharedInitializer(func_get_args(), 'initPubSub');
         return $this->sharedInitializer(func_get_args(), 'initPubSub');
     }
     }
 
 
-    protected function initPubSub(Array $options = null, $block = null) {
+    protected function initPubSub(Array $options = null, $block = null)
+    {
         $pubsub = new PubSubContext($this, $options);
         $pubsub = new PubSubContext($this, $options);
+
         if (!isset($block)) {
         if (!isset($block)) {
             return $pubsub;
             return $pubsub;
         }
         }
+
         foreach ($pubsub as $message) {
         foreach ($pubsub as $message) {
             if ($block($pubsub, $message) === false) {
             if ($block($pubsub, $message) === false) {
                 $pubsub->closeContext();
                 $pubsub->closeContext();
@@ -217,7 +255,8 @@ class Client {
         }
         }
     }
     }
 
 
-    public function monitor() {
+    public function monitor()
+    {
         return new MonitorContext($this);
         return new MonitorContext($this);
     }
     }
 }
 }

+ 2 - 1
lib/Predis/ClientException.php

@@ -2,5 +2,6 @@
 
 
 namespace Predis;
 namespace Predis;
 
 
-class ClientException extends PredisException {
+class ClientException extends PredisException
+{
 }
 }

+ 25 - 15
lib/Predis/ClientOptions.php

@@ -8,43 +8,53 @@ use Predis\Options\ClientProfile;
 use Predis\Options\ClientCluster;
 use Predis\Options\ClientCluster;
 use Predis\Options\ClientConnectionFactory;
 use Predis\Options\ClientConnectionFactory;
 
 
-class ClientOptions {
+class ClientOptions
+{
     private static $_sharedOptions;
     private static $_sharedOptions;
 
 
-    private $_options = array();
     private $_handlers;
     private $_handlers;
     private $_defined;
     private $_defined;
 
 
-    public function __construct(Array $options = array()) {
+    private $_options = array();
+
+    public function __construct(Array $options = array())
+    {
         $this->_handlers = $this->initialize($options);
         $this->_handlers = $this->initialize($options);
         $this->_defined = array_keys($options);
         $this->_defined = array_keys($options);
     }
     }
 
 
-    private static function getSharedOptions() {
+    private static function getSharedOptions()
+    {
         if (isset(self::$_sharedOptions)) {
         if (isset(self::$_sharedOptions)) {
             return self::$_sharedOptions;
             return self::$_sharedOptions;
         }
         }
+
         self::$_sharedOptions = array(
         self::$_sharedOptions = array(
             'profile' => new ClientProfile(),
             'profile' => new ClientProfile(),
             'connections' => new ClientConnectionFactory(),
             'connections' => new ClientConnectionFactory(),
             'cluster' => new ClientCluster(),
             'cluster' => new ClientCluster(),
             'prefix' => new ClientPrefix(),
             'prefix' => new ClientPrefix(),
         );
         );
+
         return self::$_sharedOptions;
         return self::$_sharedOptions;
     }
     }
 
 
-    public static function define($option, IOption $handler) {
+    public static function define($option, IOption $handler)
+    {
         self::getSharedOptions();
         self::getSharedOptions();
         self::$_sharedOptions[$option] = $handler;
         self::$_sharedOptions[$option] = $handler;
     }
     }
 
 
-    public static function undefine($option) {
+    public static function undefine($option)
+    {
         self::getSharedOptions();
         self::getSharedOptions();
         unset(self::$_sharedOptions[$option]);
         unset(self::$_sharedOptions[$option]);
     }
     }
 
 
-    private function initialize($options) {
+    private function initialize($options)
+    {
         $handlers = self::getSharedOptions();
         $handlers = self::getSharedOptions();
+
         foreach ($options as $option => $value) {
         foreach ($options as $option => $value) {
             if (isset($handlers[$option])) {
             if (isset($handlers[$option])) {
                 $handler = $handlers[$option];
                 $handler = $handlers[$option];
@@ -53,26 +63,26 @@ class ClientOptions {
                 };
                 };
             }
             }
         }
         }
+
         return $handlers;
         return $handlers;
     }
     }
 
 
-    public function __isset($option) {
+    public function __isset($option)
+    {
         return in_array($option, $this->_defined);
         return in_array($option, $this->_defined);
     }
     }
 
 
-    public function __get($option) {
+    public function __get($option)
+    {
         if (isset($this->_options[$option])) {
         if (isset($this->_options[$option])) {
             return $this->_options[$option];
             return $this->_options[$option];
         }
         }
+
         if (isset($this->_handlers[$option])) {
         if (isset($this->_handlers[$option])) {
             $handler = $this->_handlers[$option];
             $handler = $this->_handlers[$option];
-            if ($handler instanceof IOption) {
-                $value = $handler->getDefault();
-            }
-            else {
-                $value = $handler();
-            }
+            $value = $handler instanceof IOption ? $handler->getDefault() : $handler();
             $this->_options[$option] = $value;
             $this->_options[$option] = $value;
+
             return $value;
             return $value;
         }
         }
     }
     }

+ 35 - 14
lib/Predis/Commands/Command.php

@@ -5,40 +5,48 @@ namespace Predis\Commands;
 use Predis\Helpers;
 use Predis\Helpers;
 use Predis\Distribution\INodeKeyGenerator;
 use Predis\Distribution\INodeKeyGenerator;
 
 
-abstract class Command implements ICommand {
+abstract class Command implements ICommand
+{
     private $_hash;
     private $_hash;
     private $_arguments = array();
     private $_arguments = array();
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         return $arguments;
         return $arguments;
     }
     }
 
 
-    public function setArguments(Array $arguments) {
+    public function setArguments(Array $arguments)
+    {
         $this->_arguments = $this->filterArguments($arguments);
         $this->_arguments = $this->filterArguments($arguments);
         unset($this->_hash);
         unset($this->_hash);
     }
     }
 
 
-    public function setRawArguments(Array $arguments) {
+    public function setRawArguments(Array $arguments)
+    {
         $this->_arguments = $arguments;
         $this->_arguments = $arguments;
         unset($this->_hash);
         unset($this->_hash);
     }
     }
 
 
-    public function getArguments() {
+    public function getArguments()
+    {
         return $this->_arguments;
         return $this->_arguments;
     }
     }
 
 
-    public function getArgument($index = 0) {
+    public function getArgument($index = 0)
+    {
         if (isset($this->_arguments[$index]) === true) {
         if (isset($this->_arguments[$index]) === true) {
             return $this->_arguments[$index];
             return $this->_arguments[$index];
         }
         }
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         $arguments[0] = "$prefix{$arguments[0]}";
         $arguments[0] = "$prefix{$arguments[0]}";
         return $arguments;
         return $arguments;
     }
     }
 
 
-    public function prefixKeys($prefix) {
+    public function prefixKeys($prefix)
+    {
         $arguments = $this->onPrefixKeys($this->_arguments, $prefix);
         $arguments = $this->onPrefixKeys($this->_arguments, $prefix);
         if (isset($arguments)) {
         if (isset($arguments)) {
             $this->_arguments = $arguments;
             $this->_arguments = $arguments;
@@ -46,15 +54,19 @@ abstract class Command implements ICommand {
         }
         }
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return isset($this->_arguments[0]);
         return isset($this->_arguments[0]);
     }
     }
 
 
-    protected function checkSameHashForKeys(Array $keys) {
+    protected function checkSameHashForKeys(Array $keys)
+    {
         if (($count = count($keys)) === 0) {
         if (($count = count($keys)) === 0) {
             return false;
             return false;
         }
         }
+
         $currentKey = Helpers::getKeyHashablePart($keys[0]);
         $currentKey = Helpers::getKeyHashablePart($keys[0]);
+
         for ($i = 1; $i < $count; $i++) {
         for ($i = 1; $i < $count; $i++) {
             $nextKey = Helpers::getKeyHashablePart($keys[$i]);
             $nextKey = Helpers::getKeyHashablePart($keys[$i]);
             if ($currentKey !== $nextKey) {
             if ($currentKey !== $nextKey) {
@@ -62,34 +74,43 @@ abstract class Command implements ICommand {
             }
             }
             $currentKey = $nextKey;
             $currentKey = $nextKey;
         }
         }
+
         return true;
         return true;
     }
     }
 
 
-    public function getHash(INodeKeyGenerator $distributor) {
+    public function getHash(INodeKeyGenerator $distributor)
+    {
         if (isset($this->_hash)) {
         if (isset($this->_hash)) {
             return $this->_hash;
             return $this->_hash;
         }
         }
+
         if ($this->canBeHashed()) {
         if ($this->canBeHashed()) {
             $key = Helpers::getKeyHashablePart($this->_arguments[0]);
             $key = Helpers::getKeyHashablePart($this->_arguments[0]);
             $this->_hash = $distributor->generateKey($key);
             $this->_hash = $distributor->generateKey($key);
+
             return $this->_hash;
             return $this->_hash;
         }
         }
+
         return null;
         return null;
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return $data;
         return $data;
     }
     }
 
 
-    protected function toStringArgumentReducer($accumulator, $argument) {
+    protected function toStringArgumentReducer($accumulator, $argument)
+    {
         if (strlen($argument) > 32) {
         if (strlen($argument) > 32) {
             $argument = substr($argument, 0, 32) . '[...]';
             $argument = substr($argument, 0, 32) . '[...]';
         }
         }
         $accumulator .= " $argument";
         $accumulator .= " $argument";
+
         return $accumulator;
         return $accumulator;
     }
     }
 
 
-    public function __toString() {
+    public function __toString()
+    {
         return array_reduce(
         return array_reduce(
             $this->getArguments(),
             $this->getArguments(),
             array($this, 'toStringArgumentReducer'),
             array($this, 'toStringArgumentReducer'),

+ 8 - 4
lib/Predis/Commands/ConnectionAuth.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ConnectionAuth extends Command {
-    public function getId() {
+class ConnectionAuth extends Command
+{
+    public function getId()
+    {
         return 'AUTH';
         return 'AUTH';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ConnectionEcho.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ConnectionEcho extends Command {
-    public function getId() {
+class ConnectionEcho extends Command
+{
+    public function getId()
+    {
         return 'ECHO';
         return 'ECHO';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 10 - 5
lib/Predis/Commands/ConnectionPing.php

@@ -2,20 +2,25 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ConnectionPing extends Command {
-    public function getId() {
+class ConnectionPing extends Command
+{
+    public function getId()
+    {
         return 'PING';
         return 'PING';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return $data === 'PONG' ? true : false;
         return $data === 'PONG' ? true : false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ConnectionQuit.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ConnectionQuit extends Command {
-    public function getId() {
+class ConnectionQuit extends Command
+{
+    public function getId()
+    {
         return 'QUIT';
         return 'QUIT';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ConnectionSelect.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ConnectionSelect extends Command {
-    public function getId() {
+class ConnectionSelect extends Command
+{
+    public function getId()
+    {
         return 'SELECT';
         return 'SELECT';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/HashDelete.php

@@ -4,16 +4,20 @@ namespace Predis\Commands;
 
 
 use Predis\Helpers;
 use Predis\Helpers;
 
 
-class HashDelete extends Command {
-    public function getId() {
+class HashDelete extends Command
+{
+    public function getId()
+    {
         return 'HDEL';
         return 'HDEL';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         return Helpers::filterVariadicValues($arguments);
         return Helpers::filterVariadicValues($arguments);
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/HashExists.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class HashExists extends Command {
-    public function getId() {
+class HashExists extends Command
+{
+    public function getId()
+    {
         return 'HEXISTS';
         return 'HEXISTS';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/HashGet.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class HashGet extends Command {
-    public function getId() {
+class HashGet extends Command
+{
+    public function getId()
+    {
         return 'HGET';
         return 'HGET';
     }
     }
 }
 }

+ 8 - 3
lib/Predis/Commands/HashGetAll.php

@@ -4,19 +4,24 @@ namespace Predis\Commands;
 
 
 use Predis\Iterators\MultiBulkResponseTuple;
 use Predis\Iterators\MultiBulkResponseTuple;
 
 
-class HashGetAll extends Command {
-    public function getId() {
+class HashGetAll extends Command
+{
+    public function getId()
+    {
         return 'HGETALL';
         return 'HGETALL';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         if ($data instanceof \Iterator) {
         if ($data instanceof \Iterator) {
             return new MultiBulkResponseTuple($data);
             return new MultiBulkResponseTuple($data);
         }
         }
+
         $result = array();
         $result = array();
         for ($i = 0; $i < count($data); $i++) {
         for ($i = 0; $i < count($data); $i++) {
             $result[$data[$i]] = $data[++$i];
             $result[$data[$i]] = $data[++$i];
         }
         }
+
         return $result;
         return $result;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/HashGetMultiple.php

@@ -4,12 +4,15 @@ namespace Predis\Commands;
 
 
 use Predis\Helpers;
 use Predis\Helpers;
 
 
-class HashGetMultiple extends Command {
-    public function getId() {
+class HashGetMultiple extends Command
+{
+    public function getId()
+    {
         return 'HMGET';
         return 'HMGET';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         return Helpers::filterVariadicValues($arguments);
         return Helpers::filterVariadicValues($arguments);
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/HashIncrementBy.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class HashIncrementBy extends Command {
-    public function getId() {
+class HashIncrementBy extends Command
+{
+    public function getId()
+    {
         return 'HINCRBY';
         return 'HINCRBY';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/HashKeys.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class HashKeys extends Command {
-    public function getId() {
+class HashKeys extends Command
+{
+    public function getId()
+    {
         return 'HKEYS';
         return 'HKEYS';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/HashLength.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class HashLength extends Command {
-    public function getId() {
+class HashLength extends Command
+{
+    public function getId()
+    {
         return 'HLEN';
         return 'HLEN';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/HashSet.php

@@ -3,11 +3,13 @@
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
 class HashSet extends Command {
 class HashSet extends Command {
-    public function getId() {
+    public function getId()
+    {
         return 'HSET';
         return 'HSET';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 9 - 3
lib/Predis/Commands/HashSetMultiple.php

@@ -2,21 +2,27 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class HashSetMultiple extends Command {
-    public function getId() {
+class HashSetMultiple extends Command
+{
+    public function getId()
+    {
         return 'HMSET';
         return 'HMSET';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         if (count($arguments) === 2 && is_array($arguments[1])) {
         if (count($arguments) === 2 && is_array($arguments[1])) {
             $flattenedKVs = array($arguments[0]);
             $flattenedKVs = array($arguments[0]);
             $args = $arguments[1];
             $args = $arguments[1];
+
             foreach ($args as $k => $v) {
             foreach ($args as $k => $v) {
                 $flattenedKVs[] = $k;
                 $flattenedKVs[] = $k;
                 $flattenedKVs[] = $v;
                 $flattenedKVs[] = $v;
             }
             }
+
             return $flattenedKVs;
             return $flattenedKVs;
         }
         }
+
         return $arguments;
         return $arguments;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/HashSetPreserve.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class HashSetPreserve extends Command {
-    public function getId() {
+class HashSetPreserve extends Command
+{
+    public function getId()
+    {
         return 'HSETNX';
         return 'HSETNX';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/HashValues.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class HashValues extends Command {
-    public function getId() {
+class HashValues extends Command
+{
+    public function getId()
+    {
         return 'HVALS';
         return 'HVALS';
     }
     }
 }
 }

+ 2 - 1
lib/Predis/Commands/ICommand.php

@@ -4,7 +4,8 @@ namespace Predis\Commands;
 
 
 use Predis\Distribution\INodeKeyGenerator;
 use Predis\Distribution\INodeKeyGenerator;
 
 
-interface ICommand {
+interface ICommand
+{
     public function getId();
     public function getId();
     public function getHash(INodeKeyGenerator $distributor);
     public function getHash(INodeKeyGenerator $distributor);
     public function setArguments(Array $arguments);
     public function setArguments(Array $arguments);

+ 11 - 5
lib/Predis/Commands/KeyDelete.php

@@ -4,24 +4,30 @@ namespace Predis\Commands;
 
 
 use Predis\Helpers;
 use Predis\Helpers;
 
 
-class KeyDelete extends Command {
-    public function getId() {
+class KeyDelete extends Command
+{
+    public function getId()
+    {
         return 'DEL';
         return 'DEL';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         return Helpers::filterArrayArguments($arguments);
         return Helpers::filterArrayArguments($arguments);
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::multipleKeys($arguments, $prefix);
         return PrefixHelpers::multipleKeys($arguments, $prefix);
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         $args = $this->getArguments();
         $args = $this->getArguments();
         if (count($args) === 1) {
         if (count($args) === 1) {
             return true;
             return true;
         }
         }
+
         return $this->checkSameHashForKeys($args);
         return $this->checkSameHashForKeys($args);
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/KeyExists.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyExists extends Command {
-    public function getId() {
+class KeyExists extends Command
+{
+    public function getId()
+    {
         return 'EXISTS';
         return 'EXISTS';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/KeyExpire.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyExpire extends Command {
-    public function getId() {
+class KeyExpire extends Command
+{
+    public function getId()
+    {
         return 'EXPIRE';
         return 'EXPIRE';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/KeyExpireAt.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyExpireAt extends Command {
-    public function getId() {
+class KeyExpireAt extends Command
+{
+    public function getId()
+    {
         return 'EXPIREAT';
         return 'EXPIREAT';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/KeyKeys.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyKeys extends Command {
-    public function getId() {
+class KeyKeys extends Command
+{
+    public function getId()
+    {
         return 'KEYS';
         return 'KEYS';
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/KeyKeysV12x.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyKeysV12x extends KeyKeys {
-    public function parseResponse($data) {
+class KeyKeysV12x extends KeyKeys
+{
+    public function parseResponse($data)
+    {
         return explode(' ', $data);
         return explode(' ', $data);
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/KeyMove.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyMove extends Command {
-    public function getId() {
+class KeyMove extends Command
+{
+    public function getId()
+    {
         return 'MOVE';
         return 'MOVE';
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/KeyPersist.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyPersist extends Command {
-    public function getId() {
+class KeyPersist extends Command
+{
+    public function getId()
+    {
         return 'PERSIST';
         return 'PERSIST';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/KeyRandom.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyRandom extends Command {
-    public function getId() {
+class KeyRandom extends Command
+{
+    public function getId()
+    {
         return 'RANDOMKEY';
         return 'RANDOMKEY';
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return $data !== '' ? $data : null;
         return $data !== '' ? $data : null;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/KeyRename.php

@@ -3,15 +3,18 @@
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
 class KeyRename extends Command {
 class KeyRename extends Command {
-    public function getId() {
+    public function getId()
+    {
         return 'RENAME';
         return 'RENAME';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::multipleKeys($arguments, $prefix);
         return PrefixHelpers::multipleKeys($arguments, $prefix);
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/KeyRenamePreserve.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyRenamePreserve extends KeyRename {
-    public function getId() {
+class KeyRenamePreserve extends KeyRename
+{
+    public function getId()
+    {
         return 'RENAMENX';
         return 'RENAMENX';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 17 - 4
lib/Predis/Commands/KeySort.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeySort extends Command {
-    public function getId() {
+class KeySort extends Command
+{
+    public function getId()
+    {
         return 'SORT';
         return 'SORT';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         if (count($arguments) === 1) {
         if (count($arguments) === 1) {
             return $arguments;
             return $arguments;
         }
         }
@@ -19,6 +22,7 @@ class KeySort extends Command {
             $query[] = 'BY';
             $query[] = 'BY';
             $query[] = $sortParams['BY'];
             $query[] = $sortParams['BY'];
         }
         }
+
         if (isset($sortParams['GET'])) {
         if (isset($sortParams['GET'])) {
             $getargs = $sortParams['GET'];
             $getargs = $sortParams['GET'];
             if (is_array($getargs)) {
             if (is_array($getargs)) {
@@ -32,6 +36,7 @@ class KeySort extends Command {
                 $query[] = $getargs;
                 $query[] = $getargs;
             }
             }
         }
         }
+
         if (isset($sortParams['LIMIT']) && is_array($sortParams['LIMIT'])
         if (isset($sortParams['LIMIT']) && is_array($sortParams['LIMIT'])
             && count($sortParams['LIMIT']) == 2) {
             && count($sortParams['LIMIT']) == 2) {
 
 
@@ -39,12 +44,15 @@ class KeySort extends Command {
             $query[] = $sortParams['LIMIT'][0];
             $query[] = $sortParams['LIMIT'][0];
             $query[] = $sortParams['LIMIT'][1];
             $query[] = $sortParams['LIMIT'][1];
         }
         }
+
         if (isset($sortParams['SORT'])) {
         if (isset($sortParams['SORT'])) {
             $query[] = strtoupper($sortParams['SORT']);
             $query[] = strtoupper($sortParams['SORT']);
         }
         }
+
         if (isset($sortParams['ALPHA']) && $sortParams['ALPHA'] == true) {
         if (isset($sortParams['ALPHA']) && $sortParams['ALPHA'] == true) {
             $query[] = 'ALPHA';
             $query[] = 'ALPHA';
         }
         }
+
         if (isset($sortParams['STORE'])) {
         if (isset($sortParams['STORE'])) {
             $query[] = 'STORE';
             $query[] = 'STORE';
             $query[] = $sortParams['STORE'];
             $query[] = $sortParams['STORE'];
@@ -53,8 +61,10 @@ class KeySort extends Command {
         return $query;
         return $query;
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         $arguments[0] = "$prefix{$arguments[0]}";
         $arguments[0] = "$prefix{$arguments[0]}";
+
         if (($count = count($arguments)) > 1) {
         if (($count = count($arguments)) > 1) {
             for ($i = 1; $i < $count; $i++) {
             for ($i = 1; $i < $count; $i++) {
                 switch ($arguments[$i]) {
                 switch ($arguments[$i]) {
@@ -62,18 +72,21 @@ class KeySort extends Command {
                     case 'STORE':
                     case 'STORE':
                         $arguments[$i] = "$prefix{$arguments[++$i]}";
                         $arguments[$i] = "$prefix{$arguments[++$i]}";
                         break;
                         break;
+
                     case 'GET':
                     case 'GET':
                         $value = $arguments[++$i];
                         $value = $arguments[++$i];
                         if ($value !== '#') {
                         if ($value !== '#') {
                             $arguments[$i] = "$prefix$value";
                             $arguments[$i] = "$prefix$value";
                         }
                         }
                         break;
                         break;
+
                     case 'LIMIT';
                     case 'LIMIT';
                         $i += 2;
                         $i += 2;
                         break;
                         break;
                 }
                 }
             }
             }
         }
         }
+
         return $arguments;
         return $arguments;
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/KeyTimeToLive.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyTimeToLive extends Command {
-    public function getId() {
+class KeyTimeToLive extends Command
+{
+    public function getId()
+    {
         return 'TTL';
         return 'TTL';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/KeyType.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class KeyType extends Command {
-    public function getId() {
+class KeyType extends Command
+{
+    public function getId()
+    {
         return 'TYPE';
         return 'TYPE';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListIndex.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListIndex extends Command {
-    public function getId() {
+class ListIndex extends Command
+{
+    public function getId()
+    {
         return 'LINDEX';
         return 'LINDEX';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListInsert.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListInsert extends Command {
-    public function getId() {
+class ListInsert extends Command
+{
+    public function getId()
+    {
         return 'LINSERT';
         return 'LINSERT';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListLength.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListLength extends Command {
-    public function getId() {
+class ListLength extends Command
+{
+    public function getId()
+    {
         return 'LLEN';
         return 'LLEN';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListPopFirst.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListPopFirst extends Command {
-    public function getId() {
+class ListPopFirst extends Command
+{
+    public function getId()
+    {
         return 'LPOP';
         return 'LPOP';
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ListPopFirstBlocking.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListPopFirstBlocking extends Command {
-    public function getId() {
+class ListPopFirstBlocking extends Command
+{
+    public function getId()
+    {
         return 'BLPOP';
         return 'BLPOP';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::skipLastArgument($arguments, $prefix);
         return PrefixHelpers::skipLastArgument($arguments, $prefix);
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return $this->checkSameHashForKeys(
         return $this->checkSameHashForKeys(
             array_slice(($args = $this->getArguments()), 0, count($args) - 1)
             array_slice(($args = $this->getArguments()), 0, count($args) - 1)
         );
         );

+ 4 - 2
lib/Predis/Commands/ListPopLast.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListPopLast extends Command {
-    public function getId() {
+class ListPopLast extends Command
+{
+    public function getId()
+    {
         return 'RPOP';
         return 'RPOP';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListPopLastBlocking.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListPopLastBlocking extends ListPopFirstBlocking {
-    public function getId() {
+class ListPopLastBlocking extends ListPopFirstBlocking
+{
+    public function getId()
+    {
         return 'BRPOP';
         return 'BRPOP';
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ListPopLastPushHead.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListPopLastPushHead extends Command {
-    public function getId() {
+class ListPopLastPushHead extends Command
+{
+    public function getId()
+    {
         return 'RPOPLPUSH';
         return 'RPOPLPUSH';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::multipleKeys($arguments, $prefix);
         return PrefixHelpers::multipleKeys($arguments, $prefix);
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return $this->checkSameHashForKeys($this->getArguments());
         return $this->checkSameHashForKeys($this->getArguments());
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ListPopLastPushHeadBlocking.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListPopLastPushHeadBlocking extends Command {
-    public function getId() {
+class ListPopLastPushHeadBlocking extends Command
+{
+    public function getId()
+    {
         return 'BRPOPLPUSH';
         return 'BRPOPLPUSH';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::skipLastArgument($arguments, $prefix);
         return PrefixHelpers::skipLastArgument($arguments, $prefix);
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return $this->checkSameHashForKeys(
         return $this->checkSameHashForKeys(
             array_slice($args = $this->getArguments(), 0, count($args) - 1)
             array_slice($args = $this->getArguments(), 0, count($args) - 1)
         );
         );

+ 4 - 2
lib/Predis/Commands/ListPushHead.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListPushHead extends ListPushTail {
-    public function getId() {
+class ListPushHead extends ListPushTail
+{
+    public function getId()
+    {
         return 'LPUSH';
         return 'LPUSH';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListPushHeadX.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListPushHeadX extends Command {
-    public function getId() {
+class ListPushHeadX extends Command
+{
+    public function getId()
+    {
         return 'LPUSHX';
         return 'LPUSHX';
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/ListPushTail.php

@@ -4,12 +4,15 @@ namespace Predis\Commands;
 
 
 use Predis\Helpers;
 use Predis\Helpers;
 
 
-class ListPushTail extends Command {
-    public function getId() {
+class ListPushTail extends Command
+{
+    public function getId()
+    {
         return 'RPUSH';
         return 'RPUSH';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         return Helpers::filterVariadicValues($arguments);
         return Helpers::filterVariadicValues($arguments);
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListPushTailX.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListPushTailX extends Command {
-    public function getId() {
+class ListPushTailX extends Command
+{
+    public function getId()
+    {
         return 'RPUSHX';
         return 'RPUSHX';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListRange.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListRange extends Command {
-    public function getId() {
+class ListRange extends Command
+{
+    public function getId()
+    {
         return 'LRANGE';
         return 'LRANGE';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListRemove.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListRemove extends Command {
-    public function getId() {
+class ListRemove extends Command
+{
+    public function getId()
+    {
         return 'LREM';
         return 'LREM';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListSet.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListSet extends Command {
-    public function getId() {
+class ListSet extends Command
+{
+    public function getId()
+    {
         return 'LSET';
         return 'LSET';
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ListTrim.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ListTrim extends Command {
-    public function getId() {
+class ListTrim extends Command
+{
+    public function getId()
+    {
         return 'LTRIM';
         return 'LTRIM';
     }
     }
 }
 }

+ 8 - 3
lib/Predis/Commands/PrefixHelpers.php

@@ -2,19 +2,24 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class PrefixHelpers {
-    public static function multipleKeys(Array $arguments, $prefix) {
+class PrefixHelpers
+{
+    public static function multipleKeys(Array $arguments, $prefix)
+    {
         foreach ($arguments as &$key) {
         foreach ($arguments as &$key) {
             $key = "$prefix$key";
             $key = "$prefix$key";
         }
         }
+
         return $arguments;
         return $arguments;
     }
     }
 
 
-    public static function skipLastArgument(Array $arguments, $prefix) {
+    public static function skipLastArgument(Array $arguments, $prefix)
+    {
         $length = count($arguments);
         $length = count($arguments);
         for ($i = 0; $i < $length - 1; $i++) {
         for ($i = 0; $i < $length - 1; $i++) {
             $arguments[$i] = "$prefix{$arguments[$i]}";
             $arguments[$i] = "$prefix{$arguments[$i]}";
         }
         }
+
         return $arguments;
         return $arguments;
     }
     }
 }
 }

+ 2 - 1
lib/Predis/Commands/Processors/ICommandProcessor.php

@@ -4,6 +4,7 @@ namespace Predis\Commands\Processors;
 
 
 use Predis\Commands\ICommand;
 use Predis\Commands\ICommand;
 
 
-interface ICommandProcessor {
+interface ICommandProcessor
+{
     public function process(ICommand $command);
     public function process(ICommand $command);
 }
 }

+ 2 - 2
lib/Predis/Commands/Processors/ICommandProcessorChain.php

@@ -2,8 +2,8 @@
 
 
 namespace Predis\Commands\Processors;
 namespace Predis\Commands\Processors;
 
 
-interface ICommandProcessorChain
-    extends ICommandProcessor, \IteratorAggregate, \Countable {
+interface ICommandProcessorChain extends ICommandProcessor, \IteratorAggregate, \Countable
+{
 
 
     public function add(ICommandProcessor $preprocessor);
     public function add(ICommandProcessor $preprocessor);
     public function remove(ICommandProcessor $preprocessor);
     public function remove(ICommandProcessor $preprocessor);

+ 2 - 1
lib/Predis/Commands/Processors/IProcessingSupport.php

@@ -2,7 +2,8 @@
 
 
 namespace Predis\Commands\Processors;
 namespace Predis\Commands\Processors;
 
 
-interface IProcessingSupport {
+interface IProcessingSupport
+{
     public function setProcessor(ICommandProcessor $processor);
     public function setProcessor(ICommandProcessor $processor);
     public function getProcessor();
     public function getProcessor();
 }
 }

+ 10 - 5
lib/Predis/Commands/Processors/KeyPrefixProcessor.php

@@ -4,22 +4,27 @@ namespace Predis\Commands\Processors;
 
 
 use Predis\Commands\ICommand;
 use Predis\Commands\ICommand;
 
 
-class KeyPrefixProcessor implements ICommandProcessor {
+class KeyPrefixProcessor implements ICommandProcessor
+{
     private $_prefix;
     private $_prefix;
 
 
-    public function __construct($prefix) {
+    public function __construct($prefix)
+    {
         $this->setPrefix($prefix);
         $this->setPrefix($prefix);
     }
     }
 
 
-    public function setPrefix($prefix) {
+    public function setPrefix($prefix)
+    {
         $this->_prefix = $prefix;
         $this->_prefix = $prefix;
     }
     }
 
 
-    public function getPrefix() {
+    public function getPrefix()
+    {
         return $this->_prefix;
         return $this->_prefix;
     }
     }
 
 
-    public function process(ICommand $command) {
+    public function process(ICommand $command)
+    {
         $command->prefixKeys($this->_prefix);
         $command->prefixKeys($this->_prefix);
     }
     }
 }
 }

+ 26 - 13
lib/Predis/Commands/Processors/ProcessorChain.php

@@ -4,64 +4,77 @@ namespace Predis\Commands\Processors;
 
 
 use Predis\Commands\ICommand;
 use Predis\Commands\ICommand;
 
 
-class ProcessorChain implements ICommandProcessorChain, \ArrayAccess {
+class ProcessorChain implements ICommandProcessorChain, \ArrayAccess
+{
     private $_processors;
     private $_processors;
 
 
-    public function __construct($processors = array()) {
+    public function __construct($processors = array())
+    {
         foreach ($processors as $processor) {
         foreach ($processors as $processor) {
             $this->add($processor);
             $this->add($processor);
         }
         }
     }
     }
 
 
-    public function add(ICommandProcessor $processor) {
+    public function add(ICommandProcessor $processor)
+    {
         $this->_processors[] = $processor;
         $this->_processors[] = $processor;
     }
     }
 
 
-    public function remove(ICommandProcessor $processor) {
+    public function remove(ICommandProcessor $processor)
+    {
         $index = array_search($processor, $this->_processors, true);
         $index = array_search($processor, $this->_processors, true);
         if ($index !== false) {
         if ($index !== false) {
-            unset($this->_processors);
+            unset($this[$index]);
         }
         }
     }
     }
 
 
-    public function process(ICommand $command) {
+    public function process(ICommand $command)
+    {
         $count = count($this->_processors);
         $count = count($this->_processors);
         for ($i = 0; $i < $count; $i++) {
         for ($i = 0; $i < $count; $i++) {
             $this->_processors[$i]->process($command);
             $this->_processors[$i]->process($command);
         }
         }
     }
     }
 
 
-    public function getProcessors() {
+    public function getProcessors() 
+    {
         return $this->_processors;
         return $this->_processors;
     }
     }
 
 
-    public function getIterator() {
+    public function getIterator()
+    {
         return new \ArrayIterator($this->_processors);
         return new \ArrayIterator($this->_processors);
     }
     }
 
 
-    public function count() {
+    public function count()
+    {
         return count($this->_processors);
         return count($this->_processors);
     }
     }
 
 
-    public function offsetExists($index) {
+    public function offsetExists($index)
+    {
         return isset($this->_processors[$index]);
         return isset($this->_processors[$index]);
     }
     }
 
 
-    public function offsetGet($index) {
+    public function offsetGet($index)
+    {
         return $this->_processors[$index];
         return $this->_processors[$index];
     }
     }
 
 
-    public function offsetSet($index, $processor) {
+    public function offsetSet($index, $processor)
+    {
         if (!$processor instanceof ICommandProcessor) {
         if (!$processor instanceof ICommandProcessor) {
             throw new \InvalidArgumentException(
             throw new \InvalidArgumentException(
                 'A processor chain can hold only instances of classes implementing '.
                 'A processor chain can hold only instances of classes implementing '.
                 'the Predis\Commands\Preprocessors\ICommandProcessor interface'
                 'the Predis\Commands\Preprocessors\ICommandProcessor interface'
             );
             );
         }
         }
+
         $this->_processors[$index] = $processor;
         $this->_processors[$index] = $processor;
     }
     }
 
 
-    public function offsetUnset($index) {
+    public function offsetUnset($index)
+    {
         unset($this->_processors[$index]);
         unset($this->_processors[$index]);
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/PubSubPublish.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class PubSubPublish extends Command {
-    public function getId() {
+class PubSubPublish extends Command
+{
+    public function getId()
+    {
         return 'PUBLISH';
         return 'PUBLISH';
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 10 - 5
lib/Predis/Commands/PubSubSubscribe.php

@@ -4,20 +4,25 @@ namespace Predis\Commands;
 
 
 use Predis\Helpers;
 use Predis\Helpers;
 
 
-class PubSubSubscribe extends Command {
-    public function getId() {
+class PubSubSubscribe extends Command
+{
+    public function getId()
+    {
         return 'SUBSCRIBE';
         return 'SUBSCRIBE';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         return Helpers::filterArrayArguments($arguments);
         return Helpers::filterArrayArguments($arguments);
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::multipleKeys($arguments, $prefix);
         return PrefixHelpers::multipleKeys($arguments, $prefix);
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/PubSubSubscribeByPattern.php

@@ -4,8 +4,10 @@ namespace Predis\Commands;
 
 
 use Predis\Helpers;
 use Predis\Helpers;
 
 
-class PubSubSubscribeByPattern extends PubSubSubscribe {
-    public function getId() {
+class PubSubSubscribeByPattern extends PubSubSubscribe
+{
+    public function getId()
+    {
         return 'PSUBSCRIBE';
         return 'PSUBSCRIBE';
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/PubSubUnsubscribe.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class PubSubUnsubscribe extends Command {
-    public function getId() {
+class PubSubUnsubscribe extends Command
+{
+    public function getId()
+    {
         return 'UNSUBSCRIBE';
         return 'UNSUBSCRIBE';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::multipleKeys($arguments, $prefix);
         return PrefixHelpers::multipleKeys($arguments, $prefix);
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/PubSubUnsubscribeByPattern.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class PubSubUnsubscribeByPattern extends PubSubUnsubscribe {
-    public function getId() {
+class PubSubUnsubscribeByPattern extends PubSubUnsubscribe
+{
+    public function getId()
+    {
         return 'PUNSUBSCRIBE';
         return 'PUNSUBSCRIBE';
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ScriptedCommand.php

@@ -2,20 +2,24 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-abstract class ScriptedCommand extends ServerEval {
+abstract class ScriptedCommand extends ServerEval
+{
     public abstract function getScript();
     public abstract function getScript();
 
 
-    protected function keysCount() {
+    protected function keysCount()
+    {
         // The default behaviour for the base class is to use all the arguments
         // The default behaviour for the base class is to use all the arguments
         // passed to a scripted command to populate the KEYS table in Lua.
         // passed to a scripted command to populate the KEYS table in Lua.
         return count($this->getArguments());
         return count($this->getArguments());
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         return array_merge(array($this->getScript(), $this->keysCount()), $arguments);
         return array_merge(array($this->getScript(), $this->keysCount()), $arguments);
     }
     }
 
 
-    protected function getKeys() {
+    protected function getKeys()
+    {
         return array_slice($this->getArguments(), 2, $this->keysCount());
         return array_slice($this->getArguments(), 2, $this->keysCount());
     }
     }
 }
 }

+ 10 - 5
lib/Predis/Commands/ServerBackgroundRewriteAOF.php

@@ -2,20 +2,25 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerBackgroundRewriteAOF extends Command {
-    public function getId() {
+class ServerBackgroundRewriteAOF extends Command
+{
+    public function getId()
+    {
         return 'BGREWRITEAOF';
         return 'BGREWRITEAOF';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return $data == 'Background append only file rewriting started';
         return $data == 'Background append only file rewriting started';
     }
     }
 }
 }

+ 11 - 5
lib/Predis/Commands/ServerBackgroundSave.php

@@ -2,23 +2,29 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerBackgroundSave extends Command {
-    public function getId() {
+class ServerBackgroundSave extends Command
+{
+    public function getId()
+    {
         return 'BGSAVE';
         return 'BGSAVE';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         if ($data == 'Background saving started') {
         if ($data == 'Background saving started') {
             return true;
             return true;
         }
         }
+
         return $data;
         return $data;
     }
     }
 }
 }

+ 15 - 6
lib/Predis/Commands/ServerClient.php

@@ -2,32 +2,40 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerClient extends Command {
-    public function getId() {
+class ServerClient extends Command
+{
+    public function getId()
+    {
         return 'CLIENT';
         return 'CLIENT';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         $args = array_change_key_case($this->getArguments(), CASE_UPPER);
         $args = array_change_key_case($this->getArguments(), CASE_UPPER);
         switch (strtoupper($args[0])) {
         switch (strtoupper($args[0])) {
             case 'LIST':
             case 'LIST':
                 return $this->parseClientList($data);
                 return $this->parseClientList($data);
+
             case 'KILL':
             case 'KILL':
             default:
             default:
                 return $data;
                 return $data;
         }
         }
     }
     }
 
 
-    protected function parseClientList($data) {
+    protected function parseClientList($data)
+    {
         $clients = array();
         $clients = array();
+
         foreach (explode("\n", $data, -1) as $clientData) {
         foreach (explode("\n", $data, -1) as $clientData) {
             $client = array();
             $client = array();
             foreach (explode(' ', $clientData) as $kv) {
             foreach (explode(' ', $clientData) as $kv) {
@@ -36,6 +44,7 @@ class ServerClient extends Command {
             }
             }
             $clients[] = $client;
             $clients[] = $client;
         }
         }
+
         return $clients;
         return $clients;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ServerConfig.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerConfig extends Command {
-    public function getId() {
+class ServerConfig extends Command
+{
+    public function getId()
+    {
         return 'CONFIG';
         return 'CONFIG';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ServerDatabaseSize.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerDatabaseSize extends Command {
-    public function getId() {
+class ServerDatabaseSize extends Command
+{
+    public function getId()
+    {
         return 'DBSIZE';
         return 'DBSIZE';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 10 - 4
lib/Predis/Commands/ServerEval.php

@@ -2,20 +2,26 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerEval extends Command {
-    public function getId() {
+class ServerEval extends Command
+{
+    public function getId()
+    {
         return 'EVAL';
         return 'EVAL';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         $arguments = $this->getArguments();
         $arguments = $this->getArguments();
+
         for ($i = 2; $i < $arguments[1] + 2; $i++) {
         for ($i = 2; $i < $arguments[1] + 2; $i++) {
             $arguments[$i] = "$prefix{$arguments[$i]}";
             $arguments[$i] = "$prefix{$arguments[$i]}";
         }
         }
+
         return $arguments;
         return $arguments;
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/ServerEvalSHA.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerEvalSHA extends ServerEval {
-    public function getId() {
+class ServerEvalSHA extends ServerEval
+{
+    public function getId()
+    {
         return 'EVALSHA';
         return 'EVALSHA';
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ServerFlushAll.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerFlushAll extends Command {
-    public function getId() {
+class ServerFlushAll extends Command
+{
+    public function getId()
+    {
         return 'FLUSHALL';
         return 'FLUSHALL';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ServerFlushDatabase.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerFlushDatabase extends Command {
-    public function getId() {
+class ServerFlushDatabase extends Command
+{
+    public function getId()
+    {
         return 'FLUSHDB';
         return 'FLUSHDB';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 23 - 7
lib/Predis/Commands/ServerInfo.php

@@ -2,27 +2,35 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerInfo extends Command {
-    public function getId() {
+class ServerInfo extends Command
+{
+    public function getId()
+    {
         return 'INFO';
         return 'INFO';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         $info      = array();
         $info      = array();
         $infoLines = explode("\r\n", $data, -1);
         $infoLines = explode("\r\n", $data, -1);
+
         foreach ($infoLines as $row) {
         foreach ($infoLines as $row) {
             @list($k, $v) = explode(':', $row);
             @list($k, $v) = explode(':', $row);
+
             if ($row === '' || !isset($v)) {
             if ($row === '' || !isset($v)) {
                 continue;
                 continue;
             }
             }
+
             if (!preg_match('/^db\d+$/', $k)) {
             if (!preg_match('/^db\d+$/', $k)) {
                 if ($k === 'allocation_stats') {
                 if ($k === 'allocation_stats') {
                     $info[$k] = $this->parseAllocationStats($v);
                     $info[$k] = $this->parseAllocationStats($v);
@@ -34,22 +42,29 @@ class ServerInfo extends Command {
                 $info[$k] = $this->parseDatabaseStats($v);
                 $info[$k] = $this->parseDatabaseStats($v);
             }
             }
         }
         }
+
         return $info;
         return $info;
     }
     }
 
 
-    protected function parseDatabaseStats($str) {
+    protected function parseDatabaseStats($str)
+    {
         $db = array();
         $db = array();
+
         foreach (explode(',', $str) as $dbvar) {
         foreach (explode(',', $str) as $dbvar) {
             list($dbvk, $dbvv) = explode('=', $dbvar);
             list($dbvk, $dbvv) = explode('=', $dbvar);
             $db[trim($dbvk)] = $dbvv;
             $db[trim($dbvk)] = $dbvv;
         }
         }
+
         return $db;
         return $db;
     }
     }
 
 
-    protected function parseAllocationStats($str) {
+    protected function parseAllocationStats($str)
+    {
         $stats = array();
         $stats = array();
+
         foreach (explode(',', $str) as $kv) {
         foreach (explode(',', $str) as $kv) {
             @list($size, $objects, $extra) = explode('=', $kv);
             @list($size, $objects, $extra) = explode('=', $kv);
+
             // hack to prevent incorrect values when parsing the >=256 key
             // hack to prevent incorrect values when parsing the >=256 key
             if (isset($extra)) {
             if (isset($extra)) {
                 $size = ">=$objects";
                 $size = ">=$objects";
@@ -57,6 +72,7 @@ class ServerInfo extends Command {
             }
             }
             $stats[$size] = $objects;
             $stats[$size] = $objects;
         }
         }
+
         return $stats;
         return $stats;
     }
     }
 }
 }

+ 11 - 4
lib/Predis/Commands/ServerInfoV26x.php

@@ -2,21 +2,27 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerInfoV26x extends ServerInfo {
-    public function parseResponse($data) {
-        $info      = array();
-        $current   = null;
+class ServerInfoV26x extends ServerInfo
+{
+    public function parseResponse($data)
+    {
+        $info = array();
+        $current = null;
         $infoLines = explode("\r\n", $data, -1);
         $infoLines = explode("\r\n", $data, -1);
+
         foreach ($infoLines as $row) {
         foreach ($infoLines as $row) {
             if ($row === '') {
             if ($row === '') {
                 continue;
                 continue;
             }
             }
+
             if (preg_match('/^# (\w+)$/', $row, $matches)) {
             if (preg_match('/^# (\w+)$/', $row, $matches)) {
                 $info[$matches[1]] = array();
                 $info[$matches[1]] = array();
                 $current = &$info[$matches[1]];
                 $current = &$info[$matches[1]];
                 continue;
                 continue;
             }
             }
+
             list($k, $v) = explode(':', $row);
             list($k, $v) = explode(':', $row);
+
             if (!preg_match('/^db\d+$/', $k)) {
             if (!preg_match('/^db\d+$/', $k)) {
                 if ($k === 'allocation_stats') {
                 if ($k === 'allocation_stats') {
                     $current[$k] = $this->parseAllocationStats($v);
                     $current[$k] = $this->parseAllocationStats($v);
@@ -28,6 +34,7 @@ class ServerInfoV26x extends ServerInfo {
                 $current[$k] = $this->parseDatabaseStats($v);
                 $current[$k] = $this->parseDatabaseStats($v);
             }
             }
         }
         }
+
         return $info;
         return $info;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ServerLastSave.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerLastSave extends Command {
-    public function getId() {
+class ServerLastSave extends Command
+{
+    public function getId()
+    {
         return 'LASTSAVE';
         return 'LASTSAVE';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ServerMonitor.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerMonitor extends Command {
-    public function getId() {
+class ServerMonitor extends Command
+{
+    public function getId()
+    {
         return 'MONITOR';
         return 'MONITOR';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ServerObject.php

@@ -4,16 +4,20 @@ namespace Predis\Commands;
 
 
 use Predis\Helpers;
 use Predis\Helpers;
 
 
-class ServerObject extends Command {
-    public function getId() {
+class ServerObject extends Command
+{
+    public function getId()
+    {
         return 'OBJECT';
         return 'OBJECT';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/ServerSave.php

@@ -2,16 +2,20 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerSave extends Command {
-    public function getId() {
+class ServerSave extends Command
+{
+    public function getId()
+    {
         return 'SAVE';
         return 'SAVE';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/ServerShutdown.php

@@ -2,16 +2,19 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerShutdown extends Command {
+class ServerShutdown extends Command
+{
     public function getId() {
     public function getId() {
         return 'SHUTDOWN';
         return 'SHUTDOWN';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 11 - 5
lib/Predis/Commands/ServerSlaveOf.php

@@ -2,23 +2,29 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class ServerSlaveOf extends Command {
-    public function getId() {
+class ServerSlaveOf extends Command
+{
+    public function getId()
+    {
         return 'SLAVEOF';
         return 'SLAVEOF';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         if (count($arguments) === 0 || $arguments[0] === 'NO ONE') {
         if (count($arguments) === 0 || $arguments[0] === 'NO ONE') {
             return array('NO', 'ONE');
             return array('NO', 'ONE');
         }
         }
+
         return $arguments;
         return $arguments;
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         /* NOOP */
         /* NOOP */
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return false;
         return false;
     }
     }
 }
 }

+ 8 - 4
lib/Predis/Commands/SetAdd.php

@@ -4,16 +4,20 @@ namespace Predis\Commands;
 
 
 use Predis\Helpers;
 use Predis\Helpers;
 
 
-class SetAdd extends Command {
-    public function getId() {
+class SetAdd extends Command
+{
+    public function getId()
+    {
         return 'SADD';
         return 'SADD';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         return Helpers::filterVariadicValues($arguments);
         return Helpers::filterVariadicValues($arguments);
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/SetCardinality.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class SetCardinality extends Command {
-    public function getId() {
+class SetCardinality extends Command
+{
+    public function getId()
+    {
         return 'SCARD';
         return 'SCARD';
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/SetDifference.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class SetDifference extends SetIntersection {
-    public function getId() {
+class SetDifference extends SetIntersection
+{
+    public function getId()
+    {
         return 'SDIFF';
         return 'SDIFF';
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::multipleKeys($arguments, $prefix);
         return PrefixHelpers::multipleKeys($arguments, $prefix);
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/SetDifferenceStore.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class SetDifferenceStore extends SetIntersectionStore {
-    public function getId() {
+class SetDifferenceStore extends SetIntersectionStore
+{
+    public function getId()
+    {
         return 'SDIFFSTORE';
         return 'SDIFFSTORE';
     }
     }
 }
 }

+ 10 - 5
lib/Predis/Commands/SetIntersection.php

@@ -4,20 +4,25 @@ namespace Predis\Commands;
 
 
 use Predis\Helpers;
 use Predis\Helpers;
 
 
-class SetIntersection extends Command {
-    public function getId() {
+class SetIntersection extends Command
+{
+    public function getId()
+    {
         return 'SINTER';
         return 'SINTER';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         return Helpers::filterArrayArguments($arguments);
         return Helpers::filterArrayArguments($arguments);
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::multipleKeys($arguments, $prefix);
         return PrefixHelpers::multipleKeys($arguments, $prefix);
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return $this->checkSameHashForKeys($this->getArguments());
         return $this->checkSameHashForKeys($this->getArguments());
     }
     }
 }
 }

+ 11 - 5
lib/Predis/Commands/SetIntersectionStore.php

@@ -2,23 +2,29 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class SetIntersectionStore extends Command {
-    public function getId() {
+class SetIntersectionStore extends Command
+{
+    public function getId()
+    {
         return 'SINTERSTORE';
         return 'SINTERSTORE';
     }
     }
 
 
-    protected function filterArguments(Array $arguments) {
+    protected function filterArguments(Array $arguments)
+    {
         if (count($arguments) === 2 && is_array($arguments[1])) {
         if (count($arguments) === 2 && is_array($arguments[1])) {
             return array_merge(array($arguments[0]), $arguments[1]);
             return array_merge(array($arguments[0]), $arguments[1]);
         }
         }
+
         return $arguments;
         return $arguments;
     }
     }
 
 
-    protected function onPrefixKeys(Array $arguments, $prefix) {
+    protected function onPrefixKeys(Array $arguments, $prefix)
+    {
         return PrefixHelpers::multipleKeys($arguments, $prefix);
         return PrefixHelpers::multipleKeys($arguments, $prefix);
     }
     }
 
 
-    protected function canBeHashed() {
+    protected function canBeHashed()
+    {
         return $this->checkSameHashForKeys($this->getArguments());
         return $this->checkSameHashForKeys($this->getArguments());
     }
     }
 }
 }

+ 6 - 3
lib/Predis/Commands/SetIsMember.php

@@ -2,12 +2,15 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class SetIsMember extends Command {
-    public function getId() {
+class SetIsMember extends Command
+{
+    public function getId()
+    {
         return 'SISMEMBER';
         return 'SISMEMBER';
     }
     }
 
 
-    public function parseResponse($data) {
+    public function parseResponse($data)
+    {
         return (bool) $data;
         return (bool) $data;
     }
     }
 }
 }

+ 4 - 2
lib/Predis/Commands/SetMembers.php

@@ -2,8 +2,10 @@
 
 
 namespace Predis\Commands;
 namespace Predis\Commands;
 
 
-class SetMembers extends Command {
-    public function getId() {
+class SetMembers extends Command
+{
+    public function getId()
+    {
         return 'SMEMBERS';
         return 'SMEMBERS';
     }
     }
 }
 }

部分文件因为文件数量过多而无法显示