mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 11:39:21 +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.
|
||||
|
|
@ -11,21 +12,24 @@
|
|||
|
||||
namespace Predis\Command\Processor;
|
||||
|
||||
use ArrayAccess;
|
||||
use ArrayIterator;
|
||||
use InvalidArgumentException;
|
||||
use Predis\Command\CommandInterface;
|
||||
use ReturnTypeWillChange;
|
||||
use Traversable;
|
||||
|
||||
/**
|
||||
* Default implementation of a command processors chain.
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
*/
|
||||
class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
||||
class ProcessorChain implements ArrayAccess, ProcessorInterface
|
||||
{
|
||||
private $processors = array();
|
||||
private $processors = [];
|
||||
|
||||
/**
|
||||
* @param array $processors List of instances of ProcessorInterface.
|
||||
*/
|
||||
public function __construct($processors = array())
|
||||
public function __construct($processors = [])
|
||||
{
|
||||
foreach ($processors as $processor) {
|
||||
$this->add($processor);
|
||||
|
|
@ -71,11 +75,11 @@ class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
|||
/**
|
||||
* Returns an iterator over the list of command processor in the chain.
|
||||
*
|
||||
* @return \ArrayIterator
|
||||
* @return Traversable<int, ProcessorInterface>
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->processors);
|
||||
return new ArrayIterator($this->processors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -89,30 +93,36 @@ class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @param int $index
|
||||
* @return bool
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($index)
|
||||
{
|
||||
return isset($this->processors[$index]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @param int $index
|
||||
* @return ProcessorInterface
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($index)
|
||||
{
|
||||
return $this->processors[$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @param int $index
|
||||
* @param ProcessorInterface $processor
|
||||
* @return void
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($index, $processor)
|
||||
{
|
||||
if (!$processor instanceof ProcessorInterface) {
|
||||
throw new \InvalidArgumentException(
|
||||
'A processor chain accepts only instances of '.
|
||||
"'Predis\Command\Processor\ProcessorInterface'."
|
||||
throw new InvalidArgumentException(
|
||||
'Processor chain accepts only instances of `Predis\Command\Processor\ProcessorInterface`'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -120,8 +130,10 @@ class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @param int $index
|
||||
* @return void
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($index)
|
||||
{
|
||||
unset($this->processors[$index]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue