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