Conditions | 3 |
Paths | 4 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
32 | 5 | protected function updateCounter(string $valueKey, string $timeKey, int $interval): int |
|
33 | { |
||
34 | 5 | $current = $this->memcached->increment($valueKey, 1, 1, $this->intervalToMemcachedTime($interval)); |
|
35 | |||
36 | 5 | if ($current === 1) { |
|
37 | 5 | $this->memcached->add($timeKey, \time(), $this->intervalToMemcachedTime($interval)); |
|
38 | } |
||
39 | |||
40 | 5 | return $current === false ? 1 : $current; |
|
41 | } |
||
42 | |||
62 |