Sha256: 6ffa4dcb1a22b23d02f9b4bb22c534308e9cff1ee669a1dd0162a5123f37bfa0

Contents?: true

Size: 993 Bytes

Versions: 7

Compression:

Stored size: 993 Bytes

Contents

<?php

namespace Predis\Iterators;

abstract class MultiBulkResponse implements \Iterator, \Countable {
    protected $_position;
    protected $_current;
    protected $_replySize;

    public function rewind() {
        // NOOP
    }

    public function current() {
        return $this->_current;
    }

    public function key() {
        return $this->_position;
    }

    public function next() {
        if (++$this->_position < $this->_replySize) {
            $this->_current = $this->getValue();
        }
        return $this->_position;
    }

    public function valid() {
        return $this->_position < $this->_replySize;
    }

    public function count() {
        // Use count if you want to get the size of the current multi-bulk
        // response without using iterator_count (which actually consumes our
        // iterator to calculate the size, and we cannot perform a rewind)
        return $this->_replySize;
    }

    protected abstract function getValue();
}

Version data entries

7 entries across 7 versions & 1 rubygems

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