EntityManagerModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 22
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 4 1
A __construct() 0 5 1
1
<?php
2
/**
3
 * This file is part of the Ray.DoctrineOrmModule package
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace Ray\DoctrineOrmModule;
8
9
use Doctrine\ORM\EntityManagerInterface;
10
use Ray\Di\AbstractModule;
11
use Ray\Di\Scope;
12
use Ray\DoctrineOrmModule\Annotation\EntityManagerConfig;
13
14
class EntityManagerModule extends AbstractModule
15
{
16
    /**
17
     * Constructor.
18
     *
19
     * @param array        $params
20
     * @param array|string $entityDir
21
     */
22 10
    public function __construct(array $params, $entityDir)
23
    {
24 10
        parent::__construct();
25 10
        $this->bind()->annotatedWith(EntityManagerConfig::class)->toInstance([$params, $entityDir]);
26 10
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 10
    protected function configure()
32
    {
33 10
        $this->bind(EntityManagerInterface::class)->toProvider(EntityManagerProvider::class)->in(Scope::SINGLETON);
34 10
    }
35
}
36