Zend\Expressive\MarshalMiddlewareTrait::marshalMiddlewarePipe PHP Method

marshalMiddlewarePipe() private method

Each item in the array can be one of the following: - A callable middleware - A string service name of middleware to retrieve from the container - A string class name of a constructor-less middleware class to instantiate As each middleware is verified, it is piped to the middleware pipe.
private marshalMiddlewarePipe ( array $middlewares, Interop\Container\ContainerInterface $container = null, boolean $forError = false ) : MiddlewarePipe | ErrorMiddlewarePipe
$middlewares array
$container Interop\Container\ContainerInterface
$forError boolean Whether or not the middleware pipe generated is intended to be populated with error middleware; defaults to false.
return Zend\Stratigility\MiddlewarePipe | ErrorMiddlewarePipe When $forError is true, returns an ErrorMiddlewarePipe.
    private function marshalMiddlewarePipe(array $middlewares, ContainerInterface $container = null, $forError = false)
    {
        $middlewarePipe = new MiddlewarePipe();
        foreach ($middlewares as $middleware) {
            $middlewarePipe->pipe($this->prepareMiddleware($middleware, $container, $forError));
        }
        if ($forError) {
            return new ErrorMiddlewarePipe($middlewarePipe);
        }
        return $middlewarePipe;
    }