Sha256: 268cae0c0ca969ae7f53f8d6d5859b8b676eb1beec088cff80813d1536dcc311

Contents?: true

Size: 739 Bytes

Versions: 7

Compression:

Stored size: 739 Bytes

Contents

<?php

namespace Predis\Protocol\Text;

use Predis\Helpers;
use Predis\Protocol\IResponseHandler;
use Predis\Protocol\ProtocolException;
use Predis\Network\IConnectionComposable;

class ResponseBulkHandler implements IResponseHandler {
    public function handle(IConnectionComposable $connection, $lengthString) {
        $length = (int) $lengthString;
        if ($length != $lengthString) {
            Helpers::onCommunicationException(new ProtocolException(
                $connection, "Cannot parse '$length' as data length"
            ));
        }
        if ($length >= 0) {
            return substr($connection->readBytes($length + 2), 0, -2);
        }
        if ($length == -1) {
            return null;
        }
    }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
appstats-0.25.1 doc/benchmarks/Predis/Protocol/Text/ResponseBulkHandler.php
appstats-0.25.0 doc/benchmarks/Predis/Protocol/Text/ResponseBulkHandler.php
appstats-0.24.0 doc/benchmarks/Predis/Protocol/Text/ResponseBulkHandler.php
appstats-0.23.5 doc/benchmarks/Predis/Protocol/Text/ResponseBulkHandler.php
appstats-0.23.4 doc/benchmarks/Predis/Protocol/Text/ResponseBulkHandler.php
appstats-0.23.3 doc/benchmarks/Predis/Protocol/Text/ResponseBulkHandler.php
appstats-0.23.2 doc/benchmarks/Predis/Protocol/Text/ResponseBulkHandler.php