ObjectManagerServiceFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 10 1
1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/doctrine
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\Doctrine\Service;
7
8
use Zend\ServiceManager\FactoryInterface;
9
use Zend\ServiceManager\ServiceLocatorInterface;
10
use Nnx\Doctrine\ObjectManager\ObjectManagerAutoDetectorInterface;
11
use Nnx\Doctrine\EntityManager\EntityManagerInterface;
12
13
/**
14
 * Class ObjectManagerServiceFactory
15
 *
16
 * @package Nnx\Doctrine\Service
17
 */
18
class ObjectManagerServiceFactory implements FactoryInterface
19
{
20
    /**
21
     * @inheritdoc
22
     *
23
     * @param ServiceLocatorInterface $serviceLocator
24
     *
25
     * @return ObjectManagerService
26
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
27
     */
28
    public function createService(ServiceLocatorInterface $serviceLocator)
29
    {
30
        /** @var ObjectManagerAutoDetectorInterface $objectManagerAutoDetector */
31
        $objectManagerAutoDetector = $serviceLocator->get(ObjectManagerAutoDetectorInterface::class);
32
33
        /** @var EntityManagerInterface $entityManager */
34
        $entityManager = $serviceLocator->get(EntityManagerInterface::class);
35
36
        return new ObjectManagerService($objectManagerAutoDetector, $entityManager);
37
    }
38
}
39