Esempio n. 1
0
 protected function getApplicationConfig(array $configuration = array())
 {
     $config = new \Zend\Config\Config(include __DIR__ . '/../../test.config.php');
     $config->merge(new \Zend\Config\Config($this->defaultApplicationConfig));
     $config->merge(new \Zend\Config\Config($configuration));
     return $config;
 }
Esempio n. 2
0
 public function getConfig()
 {
     /* init config object */
     $config = new \Zend\Config\Config(include 'Module.config.php');
     /* autoload module configs */
     $dir = $this->_module_dir;
     $list = scandir($dir);
     foreach ($list as $item) {
         if ($item != '.' && $item != '..') {
             $file = $dir . '/' . $item . '/Config.php';
             if (file_exists($file)) {
                 $config->merge(new \Zend\Config\Config(include $file));
             }
         }
     }
     /* autoload source module configs */
     $dir = $this->_source_dir;
     if (is_dir($dir)) {
         $list = scandir($dir);
         foreach ($list as $item) {
             if ($item != '.' && $item != '..') {
                 $file = $dir . '/' . $item . '/Config.php';
                 if (file_exists($file)) {
                     $config->merge(new \Zend\Config\Config(include $file));
                 }
             }
         }
     }
     /* return merged module config */
     return $config->toArray();
 }
 public function getConfig()
 {
     // Required to be defined value used in include config files.
     $module = $this->namespace;
     $module_dir = $this->dir;
     $config = (include "{$module_dir}/config/module.config.php");
     if (defined('MY_LIBRARY_PATH') and file_exists(MY_LIBRARY_PATH . '/config/module.common.config.php')) {
         $common_config = (include MY_LIBRARY_PATH . '/config/module.common.config.php');
         $cc_object = new \Zend\Config\Config($common_config);
         $c_object = new \Zend\Config\Config($config);
         $merged_config = $c_object->merge($cc_object)->toArray();
         return $merged_config;
     }
     return $config;
 }
Esempio n. 4
0
 protected function getCircuitBreaker($config = array())
 {
     $commandConfig = new \Zend\Config\Config(array('circuitBreaker' => array('enabled' => true, 'errorThresholdPercentage' => 50, 'forceOpen' => false, 'forceClosed' => false, 'requestVolumeThreshold' => 50, 'sleepWindowInMilliseconds' => 5000, 'metrics' => array('healthSnapshotIntervalInMilliseconds' => 1000, 'rollingStatisticalWindowInMilliseconds' => 10000, 'rollingStatisticalWindowBuckets' => 10))), true);
     $commandConfig->merge(new \Zend\Config\Config($config, true));
     return new CircuitBreaker('TestCommand', $this->metrics, $commandConfig, $this->stateStorage);
 }
Esempio n. 5
0
<?php

$config = array('di' => array('instance' => array('alias' => array('user' => 'User\\Controller\\UserController'), 'Zend\\Db\\Adapter\\PdoMysql' => array('parameters' => array('config' => array('host' => 'changeme', 'dbname' => 'changeme', 'username' => 'changeme', 'password' => 'changeme', 'charset' => 'UTF8'))), 'User\\Service\\User' => array('parameters' => array('userMapper' => 'User\\Model\\Mapper\\User', 'registerForm' => 'User\\Form\\Register', 'loginForm' => 'User\\Form\\Login', 'auth' => 'Zend\\Authentication\\AuthenticationService')), 'User\\Model\\Mapper\\User' => array('parameters' => array('readAdapter' => 'Zend\\Db\\Adapter\\PdoMysql', 'writeAdapter' => 'Zend\\Db\\Adapter\\PdoMysql')), 'User\\Form\\Register' => array('parameters' => array('userMapper' => 'User\\Model\\Mapper\\User')), 'User\\Controller\\UserController' => array('parameters' => array('router' => 'Zf2Mvc\\Router\\SimpleRouteStack', 'userService' => 'User\\Service\\User')), 'Zend\\View\\PhpRenderer' => array('methods' => array('setResolver' => array('options' => array('script_paths' => array('user' => __DIR__ . '/../views'))))))));
if (file_exists(__DIR__ . '/config.' . APPLICATION_ENV . '.php')) {
    $config = new Zend\Config\Config($config, true);
    $config->merge(new Zend\Config\Config(include __DIR__ . '/config.' . APPLICATION_ENV . '.php'));
    return $config->toArray();
}
return $config;
Esempio n. 6
0
 public function getModuleConfig($moduleName)
 {
     $configKey = ucfirst($moduleName);
     if (isset($this->moduleConfig[$configKey])) {
         return $this->moduleConfig[$configKey];
     }
     $modulePath = $this->getModulePath($moduleName);
     if (!$modulePath) {
         return $this->moduleConfig[$configKey] = array();
     }
     $path = $modulePath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR;
     $globalConfig = $path . 'module.global.config.php';
     $localConfig = $path . 'module.local.config.php';
     if (false === file_exists($globalConfig)) {
         return $this->moduleConfig[$configKey] = array();
     }
     if (!file_exists($localConfig)) {
         return $this->moduleConfig[$configKey] = (include $globalConfig);
     }
     $globalConfig = new \Zend\Config\Config(include $globalConfig);
     $localConfig = new \Zend\Config\Config(include $localConfig);
     $globalConfig->merge($localConfig);
     return $this->moduleConfig[$configKey] = $globalConfig->toArray();
 }