EntityManagerFactory::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 3
cts 3
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 3
    public function __construct(ContainerInterface $container)
18
    {
19 3
        $this->container = $container;
20 3
    }
21
22
    /**
23
     * @param string $entityManagerName service name for entityManager
24
     * @return EntityManagerInterface
25
     * @throws \Exception
26
     */
27 3
    public function create(string $entityManagerName) : EntityManagerInterface
28
    {
29 3
        $entityManager = $this->container->get($entityManagerName);
30
        
31 1
        return $entityManager;
32
    }
33
}
34