public function resetContainer() { $container = $this->container = new $this->options['containerClass'](); $container->set('kernel', $this); $container->set('kernel.interceptFunctions', $this->hasFeature(\Go\Aop\Features::INTERCEPT_FUNCTIONS)); $container->set('kernel.options', $this->options); // Register kernel resources in the container for debug mode if ($this->options['debug']) { $this->addKernelResourcesToContainer($this->container); } \Go\Instrument\ClassLoading\AopComposerLoader::init($this->options, $container); // Register all AOP configuration in the container $this->configureAop($container); }
/** * {@inheritdoc} */ public function boot() { // it is a quick way to check if loader was enabled $wasDebugEnabled = class_exists('\\Symfony\\Component\\Debug\\DebugClassLoader', false); if ($wasDebugEnabled) { // disable temporary to apply AOP loader first DebugClassLoader::disable(); } $this->container->get('goaop.aspect.container'); if (!AopComposerLoader::wasInitialized()) { throw new \RuntimeException("Initialization of AOP loader was failed, probably due to Debug::enable()"); } if ($wasDebugEnabled) { DebugClassLoader::enable(); } }
/** * Init the kernel and make adjustments * * @param array $options Associative array of options for kernel */ public function init(array $options = array()) { $this->options = $this->normalizeOptions($options); define('AOP_CACHE_DIR', $this->options['cacheDir']); /** @var $container AspectContainer */ $container = $this->container = new $this->options['containerClass'](); $container->set('kernel', $this); $container->set('kernel.interceptFunctions', $this->hasFeature(Features::INTERCEPT_FUNCTIONS)); $container->set('kernel.options', $this->options); SourceTransformingLoader::register(); foreach ($this->registerTransformers() as $sourceTransformer) { SourceTransformingLoader::addTransformer($sourceTransformer); } // Register kernel resources in the container for debug mode if ($this->options['debug']) { $this->addKernelResourcesToContainer($container); } AopComposerLoader::init(); // Register all AOP configuration in the container $this->configureAop($container); }