示例#1
0
 /**
  * 
  * @param JsonDocument $composerJsonDocument
  * @param Application $app
  * @throws Exception
  * @return void
  */
 private function bootPackage(Package $package, Application $app)
 {
     $bootstrapClass = $package->getComposerJsonDocument()->getValue("/extra/bootstrap", null);
     if ($bootstrapClass !== null) {
         $bootstrap = new $bootstrapClass();
         if (!class_exists($bootstrapClass)) {
             throw new Exception($bootstrapClass . " is not exist!");
         } else {
             if (!$bootstrap instanceof BootstrapInterface) {
                 throw new Exception($bootstrapClass . " must implements yii\\base\\BootstrapInterface");
             } else {
                 Yii::trace('Boostrap with ' . $bootstrapClass, 'yii\\base\\Application::bootstrap');
                 $bootstrap->bootstrap($app);
             }
         }
     }
 }