Пример #1
0
 /**
  * Loads the App as a module moving it into the app subdirectory in case
  * it still isn't installed.
  *
  * @param $appIdentifier
  * @param NULL|BaseAppHandler $appHandler
  * @return null|\atuin\skeleton\Module
  * @throws \Exception
  * @throws yii\base\Exception
  */
 public function loadApp($appIdentifier, BaseAppHandler $appHandler = NULL)
 {
     // 1 - Checks if the app it's already declared as a Yii2 module and if that's the case
     // will return it.
     if (!is_null(Yii::$app->getModule($appIdentifier))) {
         return Yii::$app->getModule($appIdentifier);
     }
     try {
         $appHandler->getApp();
         return $this->getModule($appHandler->id, $appHandler->namespace, $appHandler->directory);
     } catch (\Exception $e) {
         throw $e;
     }
 }