Commit | Line | Data |
---|---|---|
44d399bc S |
1 | <?php |
2 | /** | |
3 | * Zend Framework (http://framework.zend.com/) | |
4 | * | |
5 | * @link http://github.com/zendframework/zf2 for the canonical source repository | |
6 | * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | |
7 | * @license http://framework.zend.com/license/new-bsd New BSD License | |
8 | */ | |
9 | ||
10 | namespace Zend\Mvc\Service; | |
11 | ||
12 | use Interop\Container\ContainerInterface; | |
13 | use Zend\ServiceManager\FactoryInterface; | |
14 | use Zend\ServiceManager\ServiceLocatorInterface; | |
15 | ||
16 | /** | |
17 | * @deprecated Since 2.7.9. The factory is now defined in zend-servicemanager-di, | |
18 | * and removed in 3.0.0. Use Zend\ServiceManager\Di\DiStrictAbstractServiceFactoryFactory | |
19 | * from zend-servicemanager-di if you are using zend-servicemanager v3, and/or when | |
20 | * ready to migrate to zend-mvc 3.0. | |
21 | */ | |
22 | class DiStrictAbstractServiceFactoryFactory implements FactoryInterface | |
23 | { | |
24 | /** | |
25 | * Class responsible for instantiating a DiStrictAbstractServiceFactory | |
26 | * | |
27 | * @param ContainerInterface $container | |
28 | * @param string $name | |
29 | * @param null|array $options | |
30 | * @return DiStrictAbstractServiceFactory | |
31 | */ | |
32 | public function __invoke(ContainerInterface $container, $name, array $options = null) | |
33 | { | |
34 | $diAbstractFactory = new DiStrictAbstractServiceFactory( | |
35 | $container->get('Di'), | |
36 | DiStrictAbstractServiceFactory::USE_SL_BEFORE_DI | |
37 | ); | |
38 | $config = $container->get('config'); | |
39 | ||
40 | if (isset($config['di']['allowed_controllers'])) { | |
41 | $diAbstractFactory->setAllowedServiceNames($config['di']['allowed_controllers']); | |
42 | } | |
43 | ||
44 | return $diAbstractFactory; | |
45 | } | |
46 | ||
47 | /** | |
48 | * Create and return DiStrictAbstractServiceFactory instance | |
49 | * | |
50 | * For use with zend-servicemanager v2; proxies to __invoke(). | |
51 | * | |
52 | * @param ServiceLocatorInterface $container | |
53 | * @return DiStrictAbstractServiceFactory | |
54 | */ | |
55 | public function createService(ServiceLocatorInterface $container) | |
56 | { | |
57 | return $this($container, DiStrictAbstractServiceFactory::class); | |
58 | } | |
59 | } |