Skip to content
docsv0.2.0

RateLimitResult

Result of a rate limit check.

RateLimitResult::__construct()

public function __construct(bool $allowed, ?string $reason = null, ?int $retryAfterSeconds = null, ?int $remainingTokens = null):

Parameters

Parameters of __construct()
NameTypeDescription
$allowedbool
$reason?string
$retryAfterSeconds?int
$remainingTokens?int

RateLimitResult::allowed()

public static function allowed(int $remainingTokens = 0): self

Build a result permitting the call, reporting how many tokens remain in the current window.

Parameters

Parameters of allowed()
NameTypeDescription
$remainingTokensint

RateLimitResult::denied()

public static function denied(string $reason, int $retryAfterSeconds = 0): self

Build a result rejecting the call, with a reason and a suggested retry delay.

Parameters

Parameters of denied()
NameTypeDescription
$reasonstring
$retryAfterSecondsint