1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace Predis\Protocol\Text\Handler;
- use Predis\CommunicationException;
- use Predis\Connection\ComposableConnectionInterface;
- use Predis\Response\Iterator\MultiBulk;
- use Predis\Protocol\ProtocolException;
- class StreamableMultiBulkResponse implements ResponseHandlerInterface
- {
-
- public function handle(ComposableConnectionInterface $connection, $payload)
- {
- $length = (int) $payload;
- if ("$length" != $payload) {
- CommunicationException::handle(new ProtocolException(
- $connection, "Cannot parse '$payload' as the length of the multibulk response"
- ));
- }
- return new MultiBulk($connection, $length);
- }
- }
|