Completed
Push — master ( d322ef...2009cd )
by Baptiste
03:15 queued 01:06
created

ContainerAwareCommandBusFactory::make()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 2
crap 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\CommandBusBundle\Factory;
5
6
use Innmind\CommandBusBundle\ContainerAwareCommandBus;
7
use Innmind\Immutable\Map;
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
10
final class ContainerAwareCommandBusFactory
11
{
12 3
    public static function make(
13
        ContainerInterface $container,
14
        array $services
15
    ): ContainerAwareCommandBus {
16 3
        $map = new Map('string', 'string');
17
18 3
        foreach ($services as $class => $service) {
19 3
            $map = $map->put($class, $service);
20
        }
21
22 3
        return new ContainerAwareCommandBus($container, $map);
23
    }
24
}
25