RetryStrategyLocatorFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TMV\Laminas\Messenger\Factory\Retry;
6
7
use Laminas\ServiceManager\ServiceManager;
8
use Psr\Container\ContainerInterface;
9
use Symfony\Component\Messenger\Retry\RetryStrategyInterface;
10
11
/**
12
 * @psalm-api
13 1
 */ /**
14
 * @psalm-api
15 1
 */
16 1
final class RetryStrategyLocatorFactory
17 1
{
18
    public function __invoke(ContainerInterface $container): ContainerInterface
19 1
    {
20
        $config = $container->has('config') ? $container->get('config') : [];
21 1
        $transports = $config['messenger']['transports'] ?? [];
22
        $factories = [];
23
24
        foreach ($transports as $name => $_) {
25 1
            $factories[$name] = static function () use ($name, $container): RetryStrategyInterface {
26
                return (new RetryStrategyFactory($name))($container);
0 ignored issues
show
Bug introduced by
The type TMV\Laminas\Messenger\Fa...ry\RetryStrategyFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
            };
28
        }
29
30
        return new ServiceManager(['factories' => $factories]);
31
    }
32
}
33