|
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
|
|
|
* |
|
24
|
|
|
* @param ContainerInterface $container |
|
25
|
|
|
* @param string $requestedName |
|
26
|
|
|
* @param null|array $options |
|
27
|
|
|
* @return object |
|
28
|
|
|
* @throws ServiceNotFoundException if unable to resolve the service. |
|
29
|
|
|
* @throws ServiceNotCreatedException if an exception is raised when |
|
30
|
|
|
* creating a service. |
|
31
|
|
|
* @throws ContainerException if any other error occurs |
|
32
|
|
|
*/ |
|
33
|
1 |
|
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
34
|
|
|
{ |
|
35
|
|
|
/** @var array $config */ |
|
36
|
1 |
|
$config = $container->get('config'); |
|
37
|
|
|
/** @var ConfigMigrationServiceInterface $configMigrationService */ |
|
38
|
1 |
|
$configMigrationService = $container->get(ConfigMigrationService::class); |
|
39
|
|
|
|
|
40
|
1 |
|
return new ConfigMigrationController($configMigrationService, $config); |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
|