Sha256: ed0b361f7eb6fb27dd32fc373f5a922bcf79b4a75d3db6596ab6546cbe5a95f5

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

<?php

namespace Predis\Commands;

class ZSetRangeByScore extends ZSetRange {
    public function getId() {
        return 'ZRANGEBYSCORE';
    }

    protected function prepareOptions($options) {
        $opts = array_change_key_case($options, CASE_UPPER);
        $finalizedOpts = array();
        if (isset($opts['LIMIT']) && is_array($opts['LIMIT'])) {
            $limit = array_change_key_case($opts['LIMIT'], CASE_UPPER);
            $finalizedOpts[] = 'LIMIT';
            $finalizedOpts[] = isset($limit['OFFSET']) ? $limit['OFFSET'] : $limit[0];
            $finalizedOpts[] = isset($limit['COUNT']) ? $limit['COUNT'] : $limit[1];
        }
        return array_merge($finalizedOpts, parent::prepareOptions($options));
    }

    protected function withScores() {
        $arguments = $this->getArguments();
        for ($i = 3; $i < count($arguments); $i++) {
            switch (strtoupper($arguments[$i])) {
                case 'WITHSCORES':
                    return true;
                case 'LIMIT':
                    $i += 2;
                    break;
            }
        }
        return false;
    }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
appstats-0.25.1 doc/benchmarks/Predis/Commands/ZSetRangeByScore.php
appstats-0.25.0 doc/benchmarks/Predis/Commands/ZSetRangeByScore.php
appstats-0.24.0 doc/benchmarks/Predis/Commands/ZSetRangeByScore.php
appstats-0.23.5 doc/benchmarks/Predis/Commands/ZSetRangeByScore.php
appstats-0.23.4 doc/benchmarks/Predis/Commands/ZSetRangeByScore.php
appstats-0.23.3 doc/benchmarks/Predis/Commands/ZSetRangeByScore.php
appstats-0.23.2 doc/benchmarks/Predis/Commands/ZSetRangeByScore.php