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

DoctrineAnnotationModule::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.216

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 2
cts 5
cp 0.4
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1.216
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\Annotation;
8
9
use Doctrine\Common\Annotations\AnnotationReader;
10
use Doctrine\Common\Annotations\CachedReader;
11
use Doctrine\Common\Annotations\Reader;
12
use Doctrine\Common\Cache\ArrayCache;
13
use Doctrine\Common\Cache\Cache;
14
use Ray\Di\AbstractModule;
15
use Ray\Di\Scope;
16
17
class DoctrineAnnotationModule extends AbstractModule
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 4
    protected function configure()
23
    {
24
        $this->bind(Cache::class)->annotatedWith('annotation_cache')->to(ArrayCache::class)->in(Scope::SINGLETON);
25
        $this->bind(Reader::class)->annotatedWith('annotation_reader')->to(AnnotationReader::class)->in(Scope::SINGLETON);
26
        $this->bind(Reader::class)->toConstructor(CachedReader::class, 'reader=annotation_reader,cache=annotation_cache')->in(Scope::SINGLETON);
27 4
    }
28
}
29