Sha256: 39a824d0c5fcc40602265344c23afd6119f8f0218867d3396e7dd69f6e0df07b

Contents?: true

Size: 730 Bytes

Versions: 7

Compression:

Stored size: 730 Bytes

Contents

<?php

namespace Predis\Iterators;

class MultiBulkResponseTuple extends MultiBulkResponse {
    private $_iterator;

    public function __construct(MultiBulkResponseSimple $iterator) {
        $virtualSize = count($iterator) / 2;
        $this->_iterator   = $iterator;
        $this->_position   = 0;
        $this->_current    = $virtualSize > 0 ? $this->getValue() : null;
        $this->_replySize  = $virtualSize;
    }

    public function __destruct() {
        $this->_iterator->sync();
    }

    protected function getValue() {
        $k = $this->_iterator->current();
        $this->_iterator->next();
        $v = $this->_iterator->current();
        $this->_iterator->next();
        return array($k, $v);
    }
}

Version data entries

7 entries across 7 versions & 1 rubygems

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