NamedModule::configure()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 2
b 0
f 0
nc 2
nop 0
dl 0
loc 5
ccs 2
cts 2
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Sunday\Module\Constant;
6
7
use Override;
8
use Ray\Di\AbstractModule;
9
10
final class NamedModule extends AbstractModule
11
{
12
    /** @param array<string, string> $names */
13
    public function __construct(
14
        private array $names,
15
    ) {
16 1
        parent::__construct();
17
    }
18 1
19 1
    #[Override]
20 1
    protected function configure(): void
21
    {
22
        foreach ($this->names as $annotatedWith => $instance) {
23
            $this->bind()->annotatedWith($annotatedWith)->toInstance($instance);
24
        }
25 1
    }
26
}
27