ContainerConfig::apply()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 5
cts 5
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Northwoods\Container\Config;
5
6
use Auryn\Injector;
7
use Northwoods\Container\InjectorConfig;
8
use Northwoods\Container\InjectorContainer;
9
use Psr\Container\ContainerInterface;
10
11
class ContainerConfig implements InjectorConfig
12
{
13 2
    public function apply(Injector $injector): void
14
    {
15
        // Assume that the container will be shared
16 2
        $injector->share(ContainerInterface::class);
17
18
        // Use the injector as the preferred container implementation
19 2
        $injector->alias(ContainerInterface::class, InjectorContainer::class);
20
21
        // The container will wrap this injector
22 2
        $injector->define(InjectorContainer::class, [':injector' => $injector]);
23 2
    }
24
}
25