Completed
Push — master ( 01eb7b...2ee407 )
by Alejandro
09:40 queued 07:02
created

ConfigMigrationControllerFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
namespace AcMailer\Controller\Factory;
3
4
use AcMailer\Controller\ConfigMigrationController;
5
use AcMailer\Service\ConfigMigrationService;
6
use AcMailer\Service\ConfigMigrationServiceInterface;
7
use Interop\Container\ContainerInterface;
8
use Interop\Container\Exception\ContainerException;
9
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
10
use Zend\ServiceManager\Exception\ServiceNotFoundException;
11
use Zend\ServiceManager\Factory\FactoryInterface;
12
use Zend\ServiceManager\ServiceLocatorInterface;
13
14
/**
15
 * Class ConfigMigrationControllerFactory
16
 * @author Alejandro Celaya Alastrué
17
 * @link http://www.alejandrocelaya.com
18
 */
19
class ConfigMigrationControllerFactory implements FactoryInterface
20
{
21
    /**
22
     * Create an object
23 1
     *
24
     * @param  ContainerInterface $container
25
     * @param  string $requestedName
26
     * @param  null|array $options
27 1
     * @return object
28
     * @throws ServiceNotFoundException if unable to resolve the service.
29 1
     * @throws ServiceNotCreatedException if an exception is raised when
30
     *     creating a service.
31 1
     * @throws ContainerException if any other error occurs
32
     */
33
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
34
    {
35
        /** @var array $config */
36
        $config = $container->get('config');
37
        /** @var ConfigMigrationServiceInterface $configMigrationService */
38
        $configMigrationService = $container->get(ConfigMigrationService::class);
39
40
        return new ConfigMigrationController($configMigrationService, $config);
41
    }
42
}
43