Phly\Conduit\MiddlewarePipe::__invoke PHP Méthode

__invoke() public méthode

Takes the pipeline, creates a Next handler, and delegates to the Next handler. If $out is a callable, it is used as the "final handler" when $next has exhausted the pipeline; otherwise, a FinalHandler instance is created and passed to $next during initialization.
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $out = null ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface
$out callable
Résultat Psr\Http\Message\ResponseInterface
    public function __invoke(Request $request, Response $response, callable $out = null)
    {
        $request = $this->decorateRequest($request);
        $response = $this->decorateResponse($response);
        $done = $out ?: new FinalHandler();
        $next = new Next($this->pipeline, $done);
        $result = $next($request, $response);
        return $result instanceof Response ? $result : $response;
    }