src/Router.php
private function run(Route $route, array $parameters)
    {
        $controller = $route->getController();

        if (count($middleware = $route->getMiddleware()) > 0) {
            $controllerRunner = function (ServerRequest $request) use ($controller, $parameters) {
                return $this->runController($controller, $parameters, $request);
            };

            return $this->runControllerThroughMiddleware($middleware, $this->request, $controllerRunner);
        } else {
            return $this->runController($controller, $parameters, $this->request);
        }
    }
private function run(Route $route, array $parameters)
    {
        $controller = $route->getController();

        if (count($middleware = $route->getMiddleware()) > 0) {
            $controllerRunner = function (ServerRequest $request) use ($controller, $parameters) {
                return $this->runController($controller, $parameters, $request);
            };

            return $this->runControllerThroughMiddleware($middleware, $this->request, $controllerRunner);
        } else {
            return $this->runController($controller, $parameters, $this->request);
        }
    }
Run the controller of the given route

@param Route $route
@param array $parameters
@return mixed|ResponseInterface
@throws InvalidControllerException
@throws InvalidMiddlewareException
@throws Throwable