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

DoctrineReflectionFactoryFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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