Completed
Pull Request — master (#18)
by
unknown
05:14
created

EntityManagerFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 1
cts 1
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Managlea\Component;
6
7
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
10
class EntityManagerFactory implements EntityManagerFactoryInterface
11
{
12
    /**
13
     * @var ContainerInterface
14
     */
15
    private $container;
16
17
    public function __construct(ContainerInterface $container)
18
    {
19 2
        $this->container = $container;
20
    }
21
22 2
    /**
23 1
     * @param string $entityManagerName service name for entityManager
24 1
     * @return EntityManagerInterface
25
     * @throws \Exception
26 1
     */
27 1
    public function create(string $entityManagerName) : EntityManagerInterface
28
    {
29 1
        $entityManager = $this->container->get($entityManagerName);
30 1
        
31
        return $entityManager;
32 1
    }
33
}
34