Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Use static rate limit methods
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 committed Apr 2, 2024
1 parent 1d85f77 commit 919a86e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Support/Concerns/WithRateLimiting.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected function rateLimit(): void
return;
}

$key = $this->getRateLimitKey();
$key = static::getRateLimitKey();

if (RateLimiter::tooManyAttempts($key, static::$maxAttempts)) {
throw new RateLimitedException(
Expand All @@ -26,15 +26,15 @@ protected function rateLimit(): void
);
}

$this->hitRateLimiter(static::$decaySeconds);
static::incrementRateLimiter(static::$decaySeconds);
}

protected function hitRateLimiter(): void
protected static function incrementRateLimiter(): void
{
RateLimiter::hit(static::getRateLimitKey(), static::$decaySeconds);
RateLimiter::increment(static::getRateLimitKey(), static::$decaySeconds);
}

protected function clearRateLimiter(): void
protected static function clearRateLimiter(): void
{
RateLimiter::clear(static::getRateLimitKey());
}
Expand Down

0 comments on commit 919a86e

Please sign in to comment.