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

This commit is contained in:
Daniele Alessandri
2010-02-27 11:52:14 +01:00
parent 47db5075ec
commit f65cb529ec
+3
View File
@@ -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]);