NamedModule::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 1
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