public function process(Request $request, ...$args)
    {
        if (!isset($this->middlewares[$this->index]) || empty($this->middlewares)) {
            return Dispatcher::PIPE_EMPTY;
        }

        $middleware = $this->middlewares[$this->index];

        $this->index++;

        $params = $args;

        if (is_array($middleware)) {
            if (isset($middleware['params'])) {
                $params = array_merge($args, $middleware['params']);
            }

            if (isset($middleware['class'])) {
                $middleware = [new $middleware['class'], 'process'];
            }
        }

        $params = [$request, [$this, 'process'], $params];

        return call_user_func_array(
            $middleware,
            $params
        );
    }
public function process(Request $request, ...$args)
    {
        if (!isset($this->middlewares[$this->index]) || empty($this->middlewares)) {
            return Dispatcher::PIPE_EMPTY;
        }

        $middleware = $this->middlewares[$this->index];

        $this->index++;

        $params = $args;

        if (is_array($middleware)) {
            if (isset($middleware['params'])) {
                $params = array_merge($args, $middleware['params']);
            }

            if (isset($middleware['class'])) {
                $middleware = [new $middleware['class'], 'process'];
            }
        }

        $params = [$request, [$this, 'process'], $params];

        return call_user_func_array(
            $middleware,
            $params
        );
    }
public function process ( Request $ request , ... $ args ) { if ( ! isset ( $ this -> middlewares [ $ this -> index ] ) || empty ( $ this -> middlewares ) ) { return Dispatcher :: PIPE_EMPTY ; } $ middleware = $ this -> middlewares [ $ this -> index ] ; $ this -> index ++ ; $ params = $ args ; if ( is_array ( $ middleware ) ) { if ( isset ( $ middleware [ 'params' ] ) ) { $ params = array_merge ( $ args , $ middleware [ 'params' ] ) ; } if ( isset ( $ middleware [ 'class' ] ) ) { $ middleware = [ new $ middleware [ 'class' ] , 'process' ] ; } } $ params = [ $ request , [ $ this , 'process' ] , $ params ] ; return call_user_func_array ( $ middleware , $ params ) ; }
Start the middleware running process

@param Request $request
@param array $args
@return mixed
Start the middleware running process