Completed
Push — master ( 8eb315...5aaba6 )
by Changwan
04:29
created

Configuration::getCaster()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
namespace Wandu\Database;
3
4
use Doctrine\Common\Annotations\AnnotationReader;
5
use Wandu\Caster\Caster;
6
use Wandu\Caster\CastManagerInterface;
7
use Wandu\Database\Contracts\Entity\MetadataReaderInterface;
8
use Wandu\Database\Entity\MetadataReader;
9
use Wandu\Event\Contracts\EventEmitter;
10
11
class Configuration
12
{
13
    /** @var \Wandu\Database\Contracts\Entity\MetadataReaderInterface */
14
    protected $metadataReader;
15
    
16
    /** @var \Wandu\Caster\CastManagerInterface */
17
    protected $caster;
18
    
19
    /** @var \Wandu\Event\Contracts\EventEmitter */
20
    protected $emitter;
21
    
22 16
    public function __construct(
23
        MetadataReaderInterface $metadataReader = null,
24
        CastManagerInterface $caster = null,
25
        EventEmitter $emitter = null
26
    ) {
27 16
        $this->metadataReader = $metadataReader ?? new MetadataReader(new AnnotationReader());
28 16
        $this->caster = $caster ?? new Caster();
29 16
        $this->emitter = $emitter;
30 16
    }
31
    
32
    /**
33
     * @return \Wandu\Database\Contracts\Entity\MetadataReaderInterface
34
     */
35 12
    public function getMetadataReader(): MetadataReaderInterface
36
    {
37 12
        return $this->metadataReader;
38
    }
39
40
    /**
41
     * @return \Wandu\Caster\CastManagerInterface
42
     */
43 12
    public function getCaster(): CastManagerInterface
44
    {
45 12
        return $this->caster;
46
    }
47
48
    /**
49
     * @return \Wandu\Event\Contracts\EventEmitter|null
50
     */
51 15
    public function getEmitter()
52
    {
53 15
        return $this->emitter;
54
    }
55
}
56