public static function init(array $options = [], AspectContainer $container)
{
$loaders = spl_autoload_functions();
foreach ($loaders as &$loader) {
$loaderToUnregister = $loader;
if (is_array($loader) && $loader[0] instanceof ClassLoader) {
$originalLoader = $loader[0];
// Configure library loader for doctrine annotation loader
AnnotationRegistry::registerLoader(function ($class) use($originalLoader) {
$originalLoader->loadClass($class);
return class_exists($class, false);
});
$loader[0] = new AopComposerLoader($loader[0], $container, $options);
self::$wasInitialized = true;
}
spl_autoload_unregister($loaderToUnregister);
}
unset($loader);
foreach ($loaders as $loader) {
spl_autoload_register($loader);
}
return self::$wasInitialized;
}
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); }