Test Failed
Push — master ( 25b8d1...f70cb8 )
by Pavel
03:49
created

DoctrineReflectionFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A createObject() 0 4 1
1
<?php
2
3
namespace ScayTrase\Api\Cruds\Adaptors\Doctrine;
4
5
use Doctrine\Bundle\DoctrineBundle\Registry;
6
use ScayTrase\Api\Cruds\Factory\ReflectionConstructorFactory;
7
use ScayTrase\Api\Cruds\ObjectFactoryInterface;
8
9
final class DoctrineReflectionFactory implements ObjectFactoryInterface
10
{
11
    /** @var  ObjectFactoryInterface */
12
    private $factory;
13
14
    /**
15
     * DoctrineReflectionFactory constructor.
16
     *
17
     * @param Registry $registry
18
     * @param string   $class
19
     * @param array    $args
20
     */
21
    public function __construct(Registry $registry, $class, array $args)
22
    {
23
        $this->factory = new ReflectionConstructorFactory(
24
            $registry->getManagerForClass($class)->getClassMetadata($class)->getName(),
25
            $args
26
        );
27
    }
28
29
    /** {@inheritdoc} */
30
    public function createObject($data)
31
    {
32
        return $this->factory->createObject($data);
33
    }
34
}
35