EntityManagerFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 3 Features 1
Metric Value
wmc 2
c 6
b 3
f 1
lcom 0
cbo 1
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 6 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