Skip to content

Commit 94ad967

Browse files
author
Mohammed Karim
committed
Small amount of refactoring.
1 parent be176c4 commit 94ad967

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

system/Throttle/Throttler.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,15 @@ public function check(string $key, int $capacity, int $seconds, int $cost = 1):
167167

168168
// If $tokens > 0, then we are safe to perform the action, but
169169
// we need to decrement the number of available tokens.
170-
$response = false;
171-
172170
if ($tokens > 0)
173171
{
174-
$response = true;
175172
$this->cache->save($tokenName, $tokens - $cost, $seconds);
176173
$this->cache->save($tokenName . 'Time', time(), $seconds);
177174

175+
return true;
178176
}
179177

180-
return $response;
178+
return false;
181179
}
182180

183181
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)