Completed
Branch 1.x (cc7bb3)
by Akihito
01:53
created

NamedModule::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 5
ccs 2
cts 4
cp 0.5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1.125
1
<?php
2
/**
3
 * This file is part of the BEAR.Sunday package
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace BEAR\Sunday\Module\Constant;
8
9
use BEAR\Sunday\FakeApplication;
10
use Ray\Di\AbstractModule;
11
12
class NamedModule extends AbstractModule
13
{
14
    /**
15
     * @var array
16
     */
17
    private $names;
18
19
    /**
20
     * @param array $names
21
     */
22 1
    public function __construct(array $names)
23
    {
24 1
        $this->names = $names;
25
        parent::__construct();
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 1
    protected function configure()
32
    {
33
        $this->bind(FakeApplication::class);
34 1
        foreach ($this->names as $annotatedWith => $instance) {
35
            $this->bind()->annotatedWith($annotatedWith)->toInstance($instance);
36
        }
37 1
    }
38
}
39