Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Mvc / Service / ControllerLoaderFactory.php
blob791e3317cd271685a6d4a05c00aa0c7e5d393e13
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Mvc\Service;
12 use Zend\Mvc\Controller\ControllerManager;
13 use Zend\Mvc\Service\DiStrictAbstractServiceFactory;
14 use Zend\ServiceManager\FactoryInterface;
15 use Zend\ServiceManager\ServiceLocatorInterface;
17 class ControllerLoaderFactory implements FactoryInterface
19 /**
20 * Create the controller loader service
22 * Creates and returns an instance of ControllerManager. The
23 * only controllers this manager will allow are those defined in the
24 * application configuration's "controllers" array. If a controller is
25 * matched, the scoped manager will attempt to load the controller.
26 * Finally, it will attempt to inject the controller plugin manager
27 * if the controller implements a setPluginManager() method.
29 * This plugin manager is _not_ peered against DI, and as such, will
30 * not load unknown classes.
32 * @param ServiceLocatorInterface $serviceLocator
33 * @return ControllerManager
35 public function createService(ServiceLocatorInterface $serviceLocator)
37 $controllerLoader = new ControllerManager();
38 $controllerLoader->setServiceLocator($serviceLocator);
39 $controllerLoader->addPeeringServiceManager($serviceLocator);
41 $config = $serviceLocator->get('Config');
43 if (isset($config['di']) && isset($config['di']['allowed_controllers']) && $serviceLocator->has('Di')) {
44 $controllerLoader->addAbstractFactory($serviceLocator->get('DiStrictAbstractServiceFactory'));
47 return $controllerLoader;