Przeglądaj źródła

Enhancement: when using multibulk response iterators, ZRANGE and ZSETRANGE now return a MultiBulkResponseKVIterator when called with the WITHSCORES parameter.

Daniele Alessandri 15 lat temu
rodzic
commit
f65cb529ec
1 zmienionych plików z 3 dodań i 0 usunięć
  1. 3 0
      lib/Predis.php

+ 3 - 0
lib/Predis.php

@@ -1555,6 +1555,9 @@ class ZSetRange extends \Predis\InlineCommand {
         $arguments = $this->getArguments();
         if (count($arguments) === 4) {
             if (strtolower($arguments[3]) === 'withscores') {
+                if ($data instanceof \Iterator) {
+                    return new \Predis\Utilities\MultiBulkResponseKVIterator($data);
+                }
                 $result = array();
                 for ($i = 0; $i < count($data); $i++) {
                     $result[] = array($data[$i], $data[++$i]);