DoctrineInstantiator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A instantiate() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Ivory Serializer package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\Serializer\Instantiator;
13
14
use Doctrine\Instantiator\Instantiator;
15
use Doctrine\Instantiator\InstantiatorInterface as DoctrineInstantiatorInterface;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20
class DoctrineInstantiator implements InstantiatorInterface
21
{
22
    /**
23
     * @var DoctrineInstantiatorInterface
24
     */
25
    private $instantiator;
26
27
    /**
28
     * @param DoctrineInstantiatorInterface|null $instantiator
29
     */
30 1492
    public function __construct(DoctrineInstantiatorInterface $instantiator = null)
31
    {
32 1492
        $this->instantiator = $instantiator ?: new Instantiator();
33 1492
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 416
    public function instantiate($class)
39
    {
40 416
        return $this->instantiator->instantiate($class);
41
    }
42
}
43