CodeExplorer getLimiters example
return $this->
doConsume($request, 1
);
} public function peek(Request
$request): RateLimit
{ return $this->
doConsume($request, 0
);
} private function doConsume(Request
$request, int
$tokens): RateLimit
{ $limiters =
$this->
getLimiters($request);
if (0 === \
count($limiters)) { $limiters =
[new NoLimiter()];
} $minimalRateLimit = null;
foreach ($limiters as $limiter) { $rateLimit =
$limiter->
consume($tokens);
$minimalRateLimit =
$minimalRateLimit ? self::
getMinimalRateLimit($minimalRateLimit,
$rateLimit) :
$rateLimit;
} return $this->
doConsume($request, 1
);
} public function peek(Request
$request): RateLimit
{ return $this->
doConsume($request, 0
);
} private function doConsume(Request
$request, int
$tokens): RateLimit
{ $limiters =
$this->
getLimiters($request);
if (0 === \
count($limiters)) { $limiters =
[new NoLimiter()];
} $minimalRateLimit = null;
foreach ($limiters as $limiter) { $rateLimit =
$limiter->
consume($tokens);
$minimalRateLimit =
$minimalRateLimit ? self::
getMinimalRateLimit($minimalRateLimit,
$rateLimit) :
$rateLimit;
}