Completed
Branch 1.x (cc7bb3)
by Akihito
02:00
created

NamedModule   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 50%

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 3
c 5
b 1
f 0
lcom 1
cbo 2
dl 0
loc 27
ccs 5
cts 10
cp 0.5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 7 2
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