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