Completed
Push — master ( 4ff9cc...589f5d )
by Pavel
07:24
created

DoctrineReflectionFactoryFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

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