public function nextMiddleware(Request $req, Response $res)
    {
        $middleware = $this->middleware->current();

        // base case - no middleware left
        if (!$middleware) {
            return $res;
        }

        // otherwise, call next middleware
        $this->middleware->next();

        return $middleware($req, $res, [$this, 'nextMiddleware']);
    }
public function nextMiddleware(Request $req, Response $res)
    {
        $middleware = $this->middleware->current();

        // base case - no middleware left
        if (!$middleware) {
            return $res;
        }

        // otherwise, call next middleware
        $this->middleware->next();

        return $middleware($req, $res, [$this, 'nextMiddleware']);
    }
public function nextMiddleware ( Request $ req , Response $ res ) { $ middleware = $ this -> middleware -> current ( ) ; // base case - no middleware left if ( ! $ middleware ) { return $ res ; } // otherwise, call next middleware $ this -> middleware -> next ( ) ; return $ middleware ( $ req , $ res , [ $ this , 'nextMiddleware' ] ) ; }
Calls the next middleware in the chain.
DO NOT call directly.

@param Request  $req
@param Response $res

@return Response
Calls the next middleware in the chain . DO NOT call directly .