protected function terminateRouteMiddleware(Request $request, Response $response): void
    {
        // Ensure a route exists
        if (! $this->app->container()->isSingleton(Route::class)) {
            return;
        }

        /* @var Route $route */
        $route = $this->app->container()->getSingleton(Route::class);

        // If the dispatched route has middleware
        if (null !== $route->getMiddleware()) {
            // Terminate each middleware
            $this->terminableMiddleware(
                $request,
                $response,
                $route->getMiddleware()
            );
        }
    }
protected function terminateRouteMiddleware(Request $request, Response $response): void
    {
        // Ensure a route exists
        if (! $this->app->container()->isSingleton(Route::class)) {
            return;
        }

        /* @var Route $route */
        $route = $this->app->container()->getSingleton(Route::class);

        // If the dispatched route has middleware
        if (null !== $route->getMiddleware()) {
            // Terminate each middleware
            $this->terminableMiddleware(
                $request,
                $response,
                $route->getMiddleware()
            );
        }
    }
protected function terminateRouteMiddleware ( Request $ request , Response $ response ) : void { // Ensure a route exists if ( ! $ this -> app -> container ( ) -> isSingleton ( Route :: class ) ) { return ; } /* @var Route $route */ $ route = $ this -> app -> container ( ) -> getSingleton ( Route :: class ) ; // If the dispatched route has middleware if ( null !== $ route -> getMiddleware ( ) ) { // Terminate each middleware $ this -> terminableMiddleware ( $ request , $ response , $ route -> getMiddleware ( ) ) ; } }
Terminate the found route's middleware.

@param Request  $request  The request
@param Response $response The response

@return void
Terminate the found route s middleware .