src/Middleware/CallableMiddlewareWrapper.php
public function process(ServerRequestInterface $request, HandlerInterface $handler)
    {
        $middleware = $this->middleware;

        if ($this->response !== null)
        {
            $handler = function ($request) use ($handler)
            {
                return $handler->{HANDLER_METHOD}($request);
            };

            $response = $this->response;

            return $middleware($request, $response, $handler);
        }

        return $middleware($request, $handler);
    }
public function process(ServerRequestInterface $request, HandlerInterface $handler)
    {
        $middleware = $this->middleware;

        if ($this->response !== null)
        {
            $handler = function ($request) use ($handler)
            {
                return $handler->{HANDLER_METHOD}($request);
            };

            $response = $this->response;

            return $middleware($request, $response, $handler);
        }

        return $middleware($request, $handler);
    }
public function process ( ServerRequestInterface $ request , HandlerInterface $ handler ) { $ middleware = $ this -> middleware ; if ( $ this -> response !== null ) { $ handler = function ( $ request ) use ( $ handler ) { return $ handler -> { HANDLER_METHOD } ( $ request ) ; } ; $ response = $ this -> response ; return $ middleware ( $ request , $ response , $ handler ) ; } return $ middleware ( $ request , $ handler ) ; }
Processes an incoming server request and return a response.

@param  \Psr\Http\Message\ServerRequestInterface      $request
@param  \Rougin\Slytherin\Middleware\HandlerInterface $handler
@return \Psr\Http\Message\ResponseInterface
Processes an incoming server request and return a response .