Esempio n. 1
0
 /**
  * Setup an environment for PSX according to the provided configuration
  *
  * @codeCoverageIgnore
  * @param \PSX\Config $config
  */
 public static function setupEnvironment(Config $config)
 {
     if (!defined('PSX')) {
         // define benchmark
         $GLOBALS['psx_benchmark'] = microtime(true);
         // define paths
         define('PSX_PATH_CACHE', $config['psx_path_cache']);
         define('PSX_PATH_LIBRARY', $config['psx_path_library']);
         // error handling
         if ($config['psx_debug'] === true) {
             $errorReporting = E_ALL | E_STRICT;
         } else {
             $errorReporting = 0;
         }
         error_reporting($errorReporting);
         set_error_handler('\\PSX\\Bootstrap::errorHandler');
         // annotation autoload
         $namespaces = $config->get('psx_annotation_autoload');
         if (!empty($namespaces) && is_array($namespaces)) {
             self::registerAnnotationLoader($namespaces);
         }
         // ini settings
         ini_set('date.timezone', $config['psx_timezone']);
         ini_set('session.use_only_cookies', '1');
         ini_set('docref_root', '');
         ini_set('html_errors', '0');
         // define in psx
         define('PSX', true);
     }
 }
Esempio n. 2
0
 public function merge(Config $config)
 {
     return new Config(array_merge($this->getArrayCopy(), $config->getArrayCopy()));
 }
Esempio n. 3
0
 public function getConfig()
 {
     $config = new Config($this->getParameter('config.file'));
     $config->set('psx_module_default', 'install');
     return $config;
 }
Esempio n. 4
0
 /**
  * @return \PSX\Config
  */
 public function getConfig()
 {
     $config = new Config($this->appendDefaultConfig());
     $config = $config->merge(Config::fromFile($this->getParameter('config.file')));
     return $config;
 }