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 / Test / Util / ModuleLoader.php
blob010a0d25eadc98772ba702559d0a171385ff8d43
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 */
9 namespace Zend\Test\Util;
11 use Zend\Mvc\Service;
12 use Zend\ServiceManager\ServiceManager;
14 class ModuleLoader
16 /**
17 * @var ServiceManager
19 protected $serviceManager;
21 /**
22 * Load list of modules or application configuration
24 * @param array $configuration
26 public function __construct(array $configuration)
28 if (!isset($configuration['modules'])) {
29 $modules = $configuration;
30 $configuration = array(
31 'module_listener_options' => array(
32 'module_paths' => array(),
34 'modules' => array(),
36 foreach ($modules as $key => $module) {
37 if (is_numeric($key)) {
38 $configuration['modules'][] = $module;
39 continue;
41 $configuration['modules'][] = $key;
42 $configuration['module_listener_options']['module_paths'][$key] = $module;
46 $smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
47 $this->serviceManager = new ServiceManager(new Service\ServiceManagerConfig($smConfig));
48 $this->serviceManager->setService('ApplicationConfig', $configuration);
49 $this->serviceManager->get('ModuleManager')->loadModules();
52 /**
53 * Get the application
55 * @return Zend\Mvc\Application
57 public function getApplication()
59 return $this->getServiceManager()->get('Application');
62 /**
63 * Get the module manager
65 * @return Zend\ModuleManager\ModuleManager
67 public function getModuleManager()
69 return $this->getServiceManager()->get('ModuleManager');
72 /**
73 * Get module
75 * @return mixed
77 public function getModule($moduleName)
79 return $this->getModuleManager()->getModule($moduleName);
82 /**
83 * Get the service manager
85 * @var ServiceManager
87 public function getServiceManager()
89 return $this->serviceManager;