EntityManagerModule::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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