src/Leevel/Throttler/Middleware/Throttler.php
public function handle(Closure $next, IRequest $request, int $limit = 60, int $time = 60): void
    {
        $rateLimiter = $this->throttler->

        setRequest($request)->

        create(null, $limit, $time);

        if ($rateLimiter->attempt()) {
            $e = new TooManyRequestsHttpException('Too many attempts.');
            $e->setHeaders($rateLimiter->header());

            throw $e;
        }

        $next($request);
    }
public function handle(Closure $next, IRequest $request, int $limit = 60, int $time = 60): void
    {
        $rateLimiter = $this->throttler->

        setRequest($request)->

        create(null, $limit, $time);

        if ($rateLimiter->attempt()) {
            $e = new TooManyRequestsHttpException('Too many attempts.');
            $e->setHeaders($rateLimiter->header());

            throw $e;
        }

        $next($request);
    }
请求

@param \Closure              $next
@param \Leevel\Http\IRequest $request
@param int                   $limit
@param int                   $time