12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace Predis\Protocol\Text;
- use Predis\Helpers;
- use Predis\Protocol\IResponseHandler;
- use Predis\Protocol\ProtocolException;
- use Predis\Network\IConnectionComposable;
- class ResponseIntegerHandler implements IResponseHandler
- {
-
- public function handle(IConnectionComposable $connection, $number)
- {
- if (is_numeric($number)) {
- return (int) $number;
- }
- if ($number !== 'nil') {
- Helpers::onCommunicationException(new ProtocolException(
- $connection, "Cannot parse '$number' as numeric response"
- ));
- }
- return null;
- }
- }
|