mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-08 22:18:28 +03:00
Predis to v2.2.2
This commit is contained in:
parent
f6b440adef
commit
84ffe1e552
259 changed files with 2407 additions and 9937 deletions
|
|
@ -3,7 +3,8 @@
|
|||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
|
@ -19,9 +20,7 @@ use Predis\Protocol\ProtocolException;
|
|||
* Handler for the integer response type in the standard Redis wire protocol.
|
||||
* It translates the payload an integer or NULL.
|
||||
*
|
||||
* @link http://redis.io/topics/protocol
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
* @see http://redis.io/topics/protocol
|
||||
*/
|
||||
class IntegerResponse implements ResponseHandlerInterface
|
||||
{
|
||||
|
|
@ -31,12 +30,14 @@ class IntegerResponse implements ResponseHandlerInterface
|
|||
public function handle(CompositeConnectionInterface $connection, $payload)
|
||||
{
|
||||
if (is_numeric($payload)) {
|
||||
return (int) $payload;
|
||||
$integer = (int) $payload;
|
||||
|
||||
return $integer == $payload ? $integer : $payload;
|
||||
}
|
||||
|
||||
if ($payload !== 'nil') {
|
||||
CommunicationException::handle(new ProtocolException(
|
||||
$connection, "Cannot parse '$payload' as a valid numeric response."
|
||||
$connection, "Cannot parse '$payload' as a valid numeric response [{$connection->getParameters()}]"
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue