mirror of
https://github.com/predis/predis.git
synced 2026-08-25 13:49:43 +00:00
22 lines
682 B
PHP
22 lines
682 B
PHP
<?php
|
|
|
|
namespace Predis\Protocols\Text;
|
|
|
|
use Predis\Helpers;
|
|
use Predis\ProtocolException;
|
|
use Predis\Protocols\IResponseHandler;
|
|
use Predis\Network\IConnectionComposable;
|
|
use Predis\Iterators\MultiBulkResponseSimple;
|
|
|
|
class ResponseMultiBulkStreamHandler 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"
|
|
));
|
|
}
|
|
return new MultiBulkResponseSimple($connection, $length);
|
|
}
|
|
}
|