WebBootstrap::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 16
ccs 0
cts 6
cp 0
crap 2
rs 9.9332
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/boot project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Boot\Bootstrap;
10
11
use Auryn\Injector;
12
use Daikon\Boot\Service\ServiceProvisioner;
13
use Daikon\Config\ConfigProvider;
14
use Daikon\Config\ConfigProviderInterface;
15
use Psr\Container\ContainerInterface;
16
17
final class WebBootstrap implements BootstrapInterface
18
{
19
    use BootstrapTrait;
20
21
    public function __invoke(Injector $injector, array $bootParams): ContainerInterface
22
    {
23
        $configProvider = $this->loadConfiguration($bootParams);
24
25
        $injector
26
            ->share($injector)
27
            ->share($configProvider)
28
            ->alias(ConfigProviderInterface::class, ConfigProvider::class);
29
30
        $container = (new ServiceProvisioner)->provision($injector, $configProvider);
31
32
        $injector
33
            ->share($container)
34
            ->alias(ContainerInterface::class, get_class($container));
35
36
        return $container;
37
    }
38
}
39