Completed
Push — dev ( 1c6cdb...867b7a )
by Андрей
05:11
created

EntityMapBuilderControllerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
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 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 12 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
13
/**
14
 * Class EntityMapBuilderController
15
 *
16
 * @package Nnx\Doctrine\Controller
17
 */
18
class EntityMapBuilderControllerFactory implements FactoryInterface
19
{
20
    /**
21
     * @inheritdoc
22
     *
23
     * @param ServiceLocatorInterface $serviceLocator
24
     *
25
     * @return EntityMapBuilderController
26
     *
27
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
28
     */
29
    public function createService(ServiceLocatorInterface $serviceLocator)
30
    {
31
        $appServiceLocator = $serviceLocator;
32
        if ($serviceLocator instanceof AbstractPluginManager) {
33
            $appServiceLocator = $serviceLocator->getServiceLocator();
34
        }
35
36
        /** @var DoctrineObjectManager $doctrineObjectManager */
37
        $doctrineObjectManager = $appServiceLocator->get(DoctrineObjectManager::class);
38
39
        return new EntityMapBuilderController($doctrineObjectManager);
40
    }
41
}
42