Completed
Push — develop ( 5a8a22...72aeee )
by Baptiste
02:16
created

ContainerBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 1
A __construct() 0 3 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Compose\ContainerBuilder;
5
6
use Innmind\Compose\{
7
    ContainerBuilder as ContainerBuilderInterface,
8
    Container,
9
    Loader
10
};
11
use Innmind\Url\PathInterface;
12
use Innmind\Immutable\MapInterface;
13
use Psr\Container\ContainerInterface;
14
15
final class ContainerBuilder implements ContainerBuilderInterface
16
{
17
    private $load;
18
19 1
    public function __construct(Loader $loader)
20
    {
21 1
        $this->load = $loader;
22 1
    }
23
24
    /**
25
     * @param MapInterface<string, mixed> $arguments
26
     */
27 1
    public function __invoke(
28
        PathInterface $definition,
29
        MapInterface $arguments
30
    ): ContainerInterface {
31 1
        $services = ($this->load)($definition);
32
33 1
        return new Container($services->inject($arguments));
34
    }
35
}
36