EntityMapBuilderControllerFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 15 2
1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/doctrine
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\Doctrine\Controller;
7
8
use Zend\ServiceManager\AbstractPluginManager;
9
use Zend\ServiceManager\FactoryInterface;
10
use Zend\ServiceManager\ServiceLocatorInterface;
11
use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
12
use Nnx\Doctrine\Utils\EntityMapCacheInterface;
13
14
15
/**
16
 * Class EntityMapBuilderController
17
 *
18
 * @package Nnx\Doctrine\Controller
19
 */
20
class EntityMapBuilderControllerFactory implements FactoryInterface
21
{
22
    /**
23
     * @inheritdoc
24
     *
25
     * @param ServiceLocatorInterface $serviceLocator
26
     *
27
     * @return EntityMapBuilderController
28
     *
29
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
30
     */
31
    public function createService(ServiceLocatorInterface $serviceLocator)
32
    {
33
        $appServiceLocator = $serviceLocator;
34
        if ($serviceLocator instanceof AbstractPluginManager) {
35
            $appServiceLocator = $serviceLocator->getServiceLocator();
36
        }
37
38
        /** @var DoctrineObjectManager $doctrineObjectManager */
39
        $doctrineObjectManager = $appServiceLocator->get(DoctrineObjectManager::class);
40
41
        /** @var EntityMapCacheInterface $entityMapCache */
42
        $entityMapCache = $appServiceLocator->get(EntityMapCacheInterface::class);
43
44
        return new EntityMapBuilderController($doctrineObjectManager, $entityMapCache);
45
    }
46
}
47