/** * 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); } }