Conditions | 4 |
Paths | 4 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | public function create(string $strategy, array $args = []): RetryStrategy |
||
10 | { |
||
11 | 3 | switch ($strategy) { |
|
12 | case RetryStrategies::CONSTANT: return new ConstantRetryStrategy(...$args); |
||
|
|||
13 | case RetryStrategies::EXPONENTIAL: return new ExponentialRetryStrategy(...$args); |
||
14 | 3 | case RetryStrategies::LINEAR: return new LinearRetryStrategy(...$args); |
|
15 | 2 | } |
|
16 | 1 | ||
17 | throw new \InvalidArgumentException(sprintf('Unknown retry strategy "%s".', $strategy)); |
||
18 | } |
||
20 |