mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +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 bulk response type in the standard Redis wire protocol.
|
||||
* It translates the payload to a string or a NULL.
|
||||
*
|
||||
* @link http://redis.io/topics/protocol
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
* @see http://redis.io/topics/protocol
|
||||
*/
|
||||
class BulkResponse implements ResponseHandlerInterface
|
||||
{
|
||||
|
|
@ -34,7 +33,7 @@ class BulkResponse implements ResponseHandlerInterface
|
|||
|
||||
if ("$length" !== $payload) {
|
||||
CommunicationException::handle(new ProtocolException(
|
||||
$connection, "Cannot parse '$payload' as a valid length for a bulk response."
|
||||
$connection, "Cannot parse '$payload' as a valid length for a bulk response [{$connection->getParameters()}]"
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +46,7 @@ class BulkResponse implements ResponseHandlerInterface
|
|||
}
|
||||
|
||||
CommunicationException::handle(new ProtocolException(
|
||||
$connection, "Value '$payload' is not a valid length for a bulk response."
|
||||
$connection, "Value '$payload' is not a valid length for a bulk response [{$connection->getParameters()}]"
|
||||
));
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -18,9 +19,7 @@ use Predis\Response\Error;
|
|||
* Handler for the error response type in the standard Redis wire protocol.
|
||||
* It translates the payload to a complex response object for Predis.
|
||||
*
|
||||
* @link http://redis.io/topics/protocol
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
* @see http://redis.io/topics/protocol
|
||||
*/
|
||||
class ErrorResponse implements ResponseHandlerInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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()}]"
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 multibulk response type in the standard Redis wire protocol.
|
||||
* It returns multibulk responses as PHP arrays.
|
||||
*
|
||||
* @link http://redis.io/topics/protocol
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
* @see http://redis.io/topics/protocol
|
||||
*/
|
||||
class MultiBulkResponse implements ResponseHandlerInterface
|
||||
{
|
||||
|
|
@ -34,7 +33,7 @@ class MultiBulkResponse implements ResponseHandlerInterface
|
|||
|
||||
if ("$length" !== $payload) {
|
||||
CommunicationException::handle(new ProtocolException(
|
||||
$connection, "Cannot parse '$payload' as a valid length of a multi-bulk response."
|
||||
$connection, "Cannot parse '$payload' as a valid length of a multi-bulk response [{$connection->getParameters()}]"
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -42,10 +41,10 @@ class MultiBulkResponse implements ResponseHandlerInterface
|
|||
return;
|
||||
}
|
||||
|
||||
$list = array();
|
||||
$list = [];
|
||||
|
||||
if ($length > 0) {
|
||||
$handlersCache = array();
|
||||
$handlersCache = [];
|
||||
$reader = $connection->getProtocol()->getResponseReader();
|
||||
|
||||
for ($i = 0; $i < $length; ++$i) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -15,8 +16,6 @@ use Predis\Connection\CompositeConnectionInterface;
|
|||
|
||||
/**
|
||||
* Defines a pluggable handler used to parse a particular type of response.
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
*/
|
||||
interface ResponseHandlerInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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\Response\Status;
|
|||
* translates certain classes of status response to PHP objects or just returns
|
||||
* the payload as a string.
|
||||
*
|
||||
* @link http://redis.io/topics/protocol
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
* @see http://redis.io/topics/protocol
|
||||
*/
|
||||
class StatusResponse implements ResponseHandlerInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -23,9 +24,7 @@ use Predis\Response\Iterator\MultiBulk as MultiBulkIterator;
|
|||
* Streamable multibulk responses are not globally supported by the abstractions
|
||||
* built-in into Predis, such as transactions or pipelines. Use them with care!
|
||||
*
|
||||
* @link http://redis.io/topics/protocol
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
* @see http://redis.io/topics/protocol
|
||||
*/
|
||||
class StreamableMultiBulkResponse implements ResponseHandlerInterface
|
||||
{
|
||||
|
|
@ -38,7 +37,7 @@ class StreamableMultiBulkResponse implements ResponseHandlerInterface
|
|||
|
||||
if ("$length" != $payload) {
|
||||
CommunicationException::handle(new ProtocolException(
|
||||
$connection, "Cannot parse '$payload' as a valid length for a multi-bulk response."
|
||||
$connection, "Cannot parse '$payload' as a valid length for a multi-bulk response [{$connection->getParameters()}]"
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue