예제 #1
0
 /**
  * Get or create the singleton alias loader instance.
  *
  * @param  array  $aliases
  * @return \Encore\Kernel\AliasLoader
  */
 public static function getInstance(array $aliases = array())
 {
     if (is_null(static::$instance)) {
         return static::$instance = new static($aliases);
     }
     $aliases = array_merge(static::$instance->getAliases(), $aliases);
     static::$instance->setAliases($aliases);
     return static::$instance;
 }
예제 #2
0
 /**
  * Boot the application
  * 
  * @return void
  */
 public function boot()
 {
     if ($this->booted) {
         return;
     }
     // Register service providers
     foreach ($this['config']->get('app.providers') as $provider) {
         $this->addProvider($provider);
     }
     // Register aliases
     AliasLoader::getInstance($this['config']->get('app.aliases'))->register();
     // Now run boot events on service providers
     array_walk($this->registered, function ($p) {
         if (method_exists($p, 'boot')) {
             $p->boot();
         }
     });
     if (file_exists($bootstrap = $this->appPath . "/bootstrap/{$this->mode}.php")) {
         require $bootstrap;
     }
     $this->booted = true;
 }