Passed
Push — visitor ( 831732...36593a )
by Akihito
01:44
created

BuiltinModule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 12 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Di;
6
7
use Ray\Compiler\MapModule;
8
use Ray\Compiler\PramReaderModule;
9
10
use function count;
11
12
final class BuiltinModule
13
{
14
    public function __invoke(AbstractModule $module): AbstractModule
15
    {
16
        $module->install(new AssistedModule());
17
        $module->install(new ProviderSetModule());
18
        $module->install(new PramReaderModule());
19
        $hasMultiBindings = count($module->getContainer()->multiBindings);
20
        if ($hasMultiBindings) {
21
            // Apply MapModule if multiple bindings are present
22
            $module->override(new MapModule());
23
        }
24
25
        return $module;
26
    }
27
}
28