init() public static method

Replaces original composer autoloader with wrapper
public static init ( array $options = [], Go\Core\AspectContainer $container ) : boolean
$options array Aspect kernel options
$container Go\Core\AspectContainer
return boolean was initialization sucessful or not
示例#1
0
 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);
 }
示例#2
0
 /**
  * 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);
 }