fix travis build
[GitHub/Stricted/Domain-Control-Panel.git] / vendor / Zend / Mvc / Service / ControllerLoaderFactory.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 Zend\Mvc\Controller\ControllerManager;
13 use Zend\ServiceManager\FactoryInterface;
14 use Zend\ServiceManager\ServiceLocatorInterface;
15
16 /**
17 * @see \Zend\Mvc\Service\ControllerManagerFactory
18 * @deprecated please use Zend\Mvc\Service\ControllerManagerFactory instead;
19 * this class will be removed in release 3.0
20 */
21 class ControllerLoaderFactory implements FactoryInterface
22 {
23 /**
24 * Create the controller loader service
25 *
26 * Creates and returns an instance of ControllerManager. The
27 * only controllers this manager will allow are those defined in the
28 * application configuration's "controllers" array. If a controller is
29 * matched, the scoped manager will attempt to load the controller.
30 * Finally, it will attempt to inject the controller plugin manager
31 * if the controller implements a setPluginManager() method.
32 *
33 * This plugin manager is _not_ peered against DI, and as such, will
34 * not load unknown classes.
35 *
36 * @param ServiceLocatorInterface $serviceLocator
37 * @return ControllerManager
38 */
39 public function createService(ServiceLocatorInterface $serviceLocator)
40 {
41 trigger_error(sprintf(
42 '%s is deprecated; please use %s instead',
43 __CLASS__,
44 ControllerManagerFactory::class
45 ), E_USER_DEPRECATED);
46
47 $controllerLoader = new ControllerManager($serviceLocator);
48 $controllerLoader->addPeeringServiceManager($serviceLocator);
49
50 $config = $serviceLocator->get('Config');
51
52 if (isset($config['di']) && isset($config['di']['allowed_controllers']) && $serviceLocator->has('Di')) {
53 $controllerLoader->addAbstractFactory($serviceLocator->get('DiStrictAbstractServiceFactory'));
54 }
55
56 return $controllerLoader;
57 }
58 }