src/Leevel/Router/Router.php
public function throughMiddleware(IRequest $passed, array $passedExtend = []): void
    {
        $method = !$passedExtend ? 'handle' : 'terminate';
        $middlewares = $this->matchedMiddlewares();

        if (empty($middlewares[$method])) {
            return;
        }

        (new Pipeline($this->container))
            ->send([$passed])
            ->send($passedExtend)
            ->through($middlewares[$method])
            ->then();
    }
public function throughMiddleware(IRequest $passed, array $passedExtend = []): void
    {
        $method = !$passedExtend ? 'handle' : 'terminate';
        $middlewares = $this->matchedMiddlewares();

        if (empty($middlewares[$method])) {
            return;
        }

        (new Pipeline($this->container))
            ->send([$passed])
            ->send($passedExtend)
            ->through($middlewares[$method])
            ->then();
    }
穿越中间件.

@param \Leevel\Http\IRequest $passed
@param array                 $passedExtend