Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function reportFailure(string $identifier, int $attemptsThreshold, int $attemptsTtl, int $failureTtl): void |
||
25 | { |
||
26 | $key = self::KEY_BASE . $identifier . '_remaining_attempts'; |
||
27 | |||
28 | if (!$this->cache->has($key)) { |
||
29 | $this->cache->set($key, $attemptsThreshold, $attemptsTtl); |
||
30 | return; |
||
31 | } |
||
32 | |||
33 | $remainingAttempts = $this->cache->decrement($key); |
||
34 | if ($remainingAttempts === 0) { |
||
35 | $this->cache->set(self::KEY_BASE . $identifier . '_failed', true, $failureTtl); |
||
36 | } |
||
37 | } |
||
38 | |||
45 |