Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
24 | 2 | ||
25 | protected function getCurrent(string $key): int |
||
26 | 2 | { |
|
27 | return (int) $this->redis->get($key); |
||
28 | 2 | } |
|
29 | |||
30 | 2 | protected function updateCounter(string $key, int $interval): int |
|
31 | 2 | { |
|
32 | $current = $this->redis->incr($key); |
||
33 | |||
34 | 2 | if ($current === 1) { |
|
35 | 2 | $this->redis->expire($key, $interval); |
|
36 | } |
||
46 |