Completed
Push — develop ( f8d1c0...c6d734 )
by Baptiste
02:31
created

ContainerBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

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;
5
6
use Innmind\Url\PathInterface;
7
use Innmind\Immutable\MapInterface;
8
use Psr\Container\ContainerInterface;
9
10
final class ContainerBuilder
11
{
12
    private $load;
13
14 1
    public function __construct(Loader $loader)
15
    {
16 1
        $this->load = $loader;
17 1
    }
18
19
    /**
20
     * @param MapInterface<string, mixed> $arguments
21
     */
22 1
    public function __invoke(
23
        PathInterface $definition,
24
        MapInterface $arguments
25
    ): ContainerInterface {
26 1
        $definitions = ($this->load)($definition);
27
28 1
        return new Container($definitions->inject($arguments));
29
    }
30
}
31