Conditions | 4 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
21 | 5 | public function isAvailable(string $serviceName): bool |
|
22 | { |
||
23 | try { |
||
24 | 5 | if ($this->storage->numberOfFailures($serviceName) < $this->maxFailures) { |
|
25 | 2 | return true; |
|
26 | } |
||
27 | |||
28 | 3 | $lastRetry = $this->getLastTryTime(); |
|
29 | 3 | if (time() - $lastRetry > $this->waitTime) { |
|
30 | 1 | return true; |
|
31 | } |
||
32 | |||
33 | 2 | return false; |
|
34 | 1 | } catch (StorageException $ex) { |
|
35 | 1 | return true; |
|
36 | } |
||
50 |