Predis to v2.2.2

This commit is contained in:
the-djmaze 2024-04-02 20:15:23 +02:00
parent f6b440adef
commit 84ffe1e552
259 changed files with 2407 additions and 9937 deletions

View file

@ -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.
@ -12,18 +13,15 @@
namespace Predis\Pipeline;
use Predis\CommunicationException;
use Predis\Connection\Aggregate\ClusterInterface;
use Predis\Connection\Cluster\ClusterInterface;
use Predis\Connection\ConnectionInterface;
use Predis\Connection\NodeConnectionInterface;
use Predis\NotSupportedException;
use SplQueue;
/**
* Command pipeline that does not throw exceptions on connection errors, but
* returns the exception instances as the rest of the response elements.
*
* @todo Awful naming!
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class ConnectionErrorProof extends Pipeline
{
@ -38,7 +36,7 @@ class ConnectionErrorProof extends Pipeline
/**
* {@inheritdoc}
*/
protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
protected function executePipeline(ConnectionInterface $connection, SplQueue $commands)
{
if ($connection instanceof NodeConnectionInterface) {
return $this->executeSingleNode($connection, $commands);
@ -54,9 +52,9 @@ class ConnectionErrorProof extends Pipeline
/**
* {@inheritdoc}
*/
protected function executeSingleNode(NodeConnectionInterface $connection, \SplQueue $commands)
protected function executeSingleNode(NodeConnectionInterface $connection, SplQueue $commands)
{
$responses = array();
$responses = [];
$sizeOfPipe = count($commands);
foreach ($commands as $command) {
@ -86,14 +84,14 @@ class ConnectionErrorProof extends Pipeline
/**
* {@inheritdoc}
*/
protected function executeCluster(ClusterInterface $connection, \SplQueue $commands)
protected function executeCluster(ClusterInterface $connection, SplQueue $commands)
{
$responses = array();
$responses = [];
$sizeOfPipe = count($commands);
$exceptions = array();
$exceptions = [];
foreach ($commands as $command) {
$cmdConnection = $connection->getConnection($command);
$cmdConnection = $connection->getConnectionByCommand($command);
if (isset($exceptions[spl_object_hash($cmdConnection)])) {
continue;
@ -109,7 +107,7 @@ class ConnectionErrorProof extends Pipeline
for ($i = 0; $i < $sizeOfPipe; ++$i) {
$command = $commands->dequeue();
$cmdConnection = $connection->getConnection($command);
$cmdConnection = $connection->getConnectionByCommand($command);
$connectionHash = spl_object_hash($cmdConnection);
if (isset($exceptions[$connectionHash])) {