ExecutorControllerFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 13 2
1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/doctrine-fixture-module
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\DoctrineFixtureModule\Controller;
7
8
use Nnx\DoctrineFixtureModule\Executor\FixtureExecutorManagerInterface;
9
use Zend\ServiceManager\AbstractPluginManager;
10
use Zend\ServiceManager\FactoryInterface;
11
use Zend\ServiceManager\ServiceLocatorInterface;
12
13
/**
14
 * Class ExecutorControllerFactory
15
 *
16
 * @package Nnx\DoctrineFixtureModule\Entity
17
 */
18
class ExecutorControllerFactory implements FactoryInterface
19
{
20
    /**
21
     * @inheritDoc
22
     *
23
     * @return ExecutorController
24
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
25
     */
26
    public function createService(ServiceLocatorInterface $serviceLocator)
27
    {
28
        $appServiceLocator = $serviceLocator;
29
        if ($serviceLocator instanceof AbstractPluginManager) {
30
            $appServiceLocator = $serviceLocator->getServiceLocator();
31
        }
32
33
        /** @var FixtureExecutorManagerInterface $fixtureExecutorManager */
34
        $fixtureExecutorManager = $appServiceLocator->get(FixtureExecutorManagerInterface::class);
35
36
37
        return new ExecutorController($fixtureExecutorManager);
38
    }
39
}
40