use zend router
[GitHub/Stricted/Domain-Control-Panel.git] / vendor / Zend / Mvc / Service / DiServiceInitializerFactory.php
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\Mvc\Exception;
14 use Zend\ServiceManager\Di\DiServiceInitializer;
15 use Zend\ServiceManager\FactoryInterface;
16 use Zend\ServiceManager\ServiceLocatorInterface;
17 use Zend\ServiceManager\ServiceManager;
18
19 /**
20 * @deprecated Since 2.7.9. The factory is now defined in zend-servicemanager-di,
21 * and removed in 3.0.0. Use Zend\ServiceManager\Di\DiServiceInitializerFactory
22 * from zend-servicemanager-di if you are using zend-servicemanager v3, and/or when
23 * ready to migrate to zend-mvc 3.0.
24 */
25 class DiServiceInitializerFactory implements FactoryInterface
26 {
27 /**
28 * Class responsible for instantiating a DiServiceInitializer
29 *
30 * @param ContainerInterface $container
31 * @param string $name
32 * @param null|array $options
33 * @return DiServiceInitializer
34 */
35 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
36 {
37 if (! class_exists(DiServiceInitializer::class)) {
38 throw new Exception\RuntimeException(sprintf(
39 "%s is not compatible with zend-servicemanager v3, which you are currently using. \n"
40 . "Please run 'composer require zendframework/zend-servicemanager-di', and then update\n"
41 . "your configuration to use Zend\ServiceManager\Di\DiServiceInitializerFactory instead.",
42 __CLASS__
43 ));
44 }
45
46 return new DiServiceInitializer($container->get('Di'), $container);
47 }
48
49 /**
50 * Create and return DiServiceInitializer instance
51 *
52 * For use with zend-servicemanager v2; proxies to __invoke().
53 *
54 * @param ServiceLocatorInterface $container
55 * @return DiServiceInitializer
56 */
57 public function createService(ServiceLocatorInterface $container)
58 {
59 return $this($container, DiServiceInitializer::class);
60 }
61 }