Zend\Stratigility\Next::__construct PHP Method

__construct() public method

Clones the queue provided to allow re-use.
public __construct ( SplQueue $queue, callable | Interop\Http\Middleware\DelegateInterface $done )
$queue SplQueue
$done callable | Interop\Http\Middleware\DelegateInterface Next delegate to invoke when the queue is exhausted. Note: this argument becomes optional starting in 2.0.0.
    public function __construct(SplQueue $queue, $done)
    {
        if (!(is_callable($done) || $done instanceof DelegateInterface)) {
            throw new InvalidArgumentException(sprintf('Invalid "$done" argument provided to %s; must be callable ' . 'or a %s instance; received %s', get_class($this), DelegateInterface::class, is_object($done) ? get_class($done) : gettype($done)));
        }
        $this->queue = clone $queue;
        $this->nextDelegate = $done;
        $this->dispatch = new Dispatch();
    }