mirror of
https://github.com/predis/predis.git
synced 2026-09-17 05:47:05 +00:00
ZSetReverseRange now inherits from ZSetRange as the two commands share the same behaviour. This change allowed us to remove some code duplication.
This commit is contained in:
+1
-14
@@ -1231,21 +1231,8 @@ class ZSetRange extends \Predis\InlineCommand {
|
||||
}
|
||||
}
|
||||
|
||||
class ZSetReverseRange extends \Predis\InlineCommand {
|
||||
class ZSetReverseRange extends \Predis\Commands\ZSetRange {
|
||||
public function getCommandId() { return 'ZREVRANGE'; }
|
||||
public function parseResponse($data) {
|
||||
$arguments = $this->getArguments();
|
||||
if (count($arguments) === 4) {
|
||||
if (strtolower($arguments[3]) === 'withscores') {
|
||||
$result = array();
|
||||
for ($i = 0; $i < count($data); $i++) {
|
||||
$result[] = array($data[$i], $data[++$i]);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
class ZSetRangeByScore extends \Predis\InlineCommand {
|
||||
|
||||
Reference in New Issue
Block a user