mirror of
https://github.com/predis/predis.git
synced 2026-08-20 15:11:50 +00:00
21 lines
646 B
PHP
21 lines
646 B
PHP
<?php
|
|
|
|
namespace Predis\Protocols;
|
|
|
|
use Predis\Utils;
|
|
use Predis\MalformedServerResponse;
|
|
use Predis\Network\IConnectionComposable;
|
|
use Predis\Iterators\MultiBulkResponseSimple;
|
|
|
|
class ResponseMultiBulkStreamHandler implements IResponseHandler {
|
|
public function handle(IConnectionComposable $connection, $lengthString) {
|
|
$length = (int) $lengthString;
|
|
if ($length != $lengthString) {
|
|
Utils::onCommunicationException(new MalformedServerResponse(
|
|
$connection, "Cannot parse '$length' as data length"
|
|
));
|
|
}
|
|
return new MultiBulkResponseSimple($connection, $length);
|
|
}
|
|
}
|