浏览代码

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

Daniele Alessandri 15 年之前
父节点
当前提交
f65cb529ec
共有 1 个文件被更改,包括 3 次插入0 次删除
  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]);