Skip to content

Commit 2d66981

Browse files
committed
Throttler code style update
1 parent 246ab82 commit 2d66981

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

system/Throttle/Throttler.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ public function check(string $key, int $capacity, int $seconds, int $cost = 1):
139139
$tokenName = $this->prefix . $key;
140140

141141
// Check to see if the bucket has even been created yet.
142-
if (($tokens = $this->cache->get($tokenName)) === null) {
142+
if (($tokens = $this->cache->get($tokenName)) === null)
143+
{
143144
// If it hasn't been created, then we'll set it to the maximum
144145
// capacity - 1, and save it to the cache.
145146
$this->cache->save($tokenName, $capacity - $cost, $seconds);
@@ -170,7 +171,8 @@ public function check(string $key, int $capacity, int $seconds, int $cost = 1):
170171

171172
// If $tokens >= 1, then we are safe to perform the action, but
172173
// we need to decrement the number of available tokens.
173-
if ($tokens >= 1) {
174+
if ($tokens >= 1)
175+
{
174176
$this->cache->save($tokenName, $tokens - $cost, $seconds);
175177
$this->cache->save($tokenName . 'Time', time(), $seconds);
176178

0 commit comments

Comments
 (0)