protected function __construct(array $options)
{
// Setup logger.
$this->_logger = \Logger::getLogger(get_class($this));
$this->_logDebugEnabled = $this->_logger->isDebugEnabled();
$soullessArray = array();
$this->_beanAliases = $soullessArray;
$this->_beanDefs = $soullessArray;
$this->_beans = $soullessArray;
$this->_shutdowners = $soullessArray;
$this->_resources = $soullessArray;
$this->_eventListeners = $soullessArray;
$this->_properties = $soullessArray;
// Merge options with our defaults.
self::$_options = array_replace_recursive(self::$_options, $options);
$this->registerProperties(self::$_options['properties']);
$sapi = php_sapi_name();
if (function_exists('pcntl_signal')) {
if ($sapi == 'cgi' || $sapi == 'cli') {
$signals = array(SIGQUIT, SIGHUP, SIGINT, SIGCHLD, SIGTERM, SIGUSR1, SIGUSR2);
$handler = array($this, 'signalHandler');
foreach ($signals as $signal) {
pcntl_signal($signal, $handler);
}
pcntl_sigprocmask(SIG_UNBLOCK, $signals);
}
}
set_error_handler(array($this, 'errorHandler'));
register_shutdown_function(array($this, 'shutdownHandler'));
$this->_lifecycleManager = new BeanLifecycleManager();
$this->_dispatcherTemplate = new DispatcherImpl();
$this->_aspectManager = new AspectManager();
$this->_aspectManager->setCache(DummyCacheImpl::getInstance());
$this->_beanDefCache = DummyCacheImpl::getInstance();
$this->_beanCache = DummyCacheImpl::getInstance();
$this->registerBeanDefinitionProvider(new Core(self::$_options));
$this->_reflectionFactory = $this;
$this->_reflectionFactory = $this->getBean('dingReflectionFactory');
$this->_proxyFactory = $this->getBean('dingProxyFactory');
$this->_beanDefCache = $this->getBean('dingDefinitionsCache');
$this->_beanCache = $this->getBean('dingBeanCache');
$this->_lifecycleManager = $this->getBean('dingLifecycleManager');
$this->_aspectManager = $this->getBean('dingAspectManager');
$this->_dispatcherTemplate = $this->getBean('dingAspectCallDispatcher');
// Set drivers
if (isset(self::$_options['bdef']['xml'])) {
$xmlDriver = $this->getBean('dingXmlBeanDefinitionProvider');
}
if (isset(self::$_options['bdef']['yaml'])) {
$yamlDriver = $this->getBean('dingYamlBeanDefinitionProvider');
}
$this->getBean('dingPropertiesDriver');
$this->getBean('dingMessageSourceDriver');
$this->getBean('dingMethodInjectionDriver');
// All set, continue.
if (isset(self::$_options['bdef']['annotation'])) {
$this->getBean('dingAnnotationDiscovererDriver');
$this->getBean('dingAnnotationBeanDefinitionProvider');
$this->getBean('dingAnnotationValueDriver');
$this->getBean('dingAnnotationResourceDriver');
$this->getBean('dingAnnotationInjectDriver');
$this->getBean('dingAnnotationInitDestroyMethodDriver');
$this->getBean('dingAnnotationRequiredDriver');
$this->getBean('dingMvcAnnotationDriver');
}
$this->_lifecycleManager->afterConfig();
}