Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | 3 | public function __invoke(ContainerInterface $container): RetryStrategyInterface |
|
23 | { |
||
24 | /** @var array $config */ |
||
25 | 3 | $config = $container->has('config') ? $container->get('config') : []; |
|
26 | |||
27 | /** @var array|array<string, float|int>|string $retryConfig */ |
||
28 | 3 | $retryConfig = $config['messenger']['transports'][$this->transportName]['retry_strategy'] ?? []; |
|
29 | |||
30 | 3 | if (is_string($retryConfig)) { |
|
|
|||
31 | 2 | return $container->get($retryConfig); |
|
32 | } |
||
33 | |||
34 | 1 | return new MultiplierRetryStrategy( |
|
35 | 1 | (int) ($retryConfig['max_retries'] ?? 3), |
|
36 | 1 | (int) ($retryConfig['delay'] ?? 1000), |
|
37 | 1 | (float) ($retryConfig['multiplier'] ?? 2.), |
|
38 | 1 | (int) ($retryConfig['max_delay'] ?? 0) |
|
39 | ); |
||
42 |