original_string: protected function addAdmin()
      {
          if ($this->module->userComponent !== true) {
              return $this->addInheritedAdmin();
          }
          $transaction = $this->db->beginTransaction();
          try {
              $admin = new User();
              $admin->setScenario('installation');
              $admin->setAttributes([
                  'username' => self::DEFAULT_USERNAME,
                  'status' => User::STATUS_ACTIVE,
                  'role' => User::ROLE_ADMIN,
              ], false);
              $admin->generateAuthKey();
              $admin->setPassword(self::DEFAULT_USERNAME);
              if (!$admin->save()) {
                  throw new Exception(VarDumper::dumpAsString($admin->errors));
              }
              if (!$this->authManager->assign($this->authManager->getRole(Rbac::ROLE_ADMIN), $admin->id)) {
                  throw new Exception('Error during Administrator privileges setting!');
              }
              $transaction->commit();
              return $this->returnSuccess(
                  Yii::t('podium/flash', 'Administrator account has been created.')
                  . ' ' . Html::tag('strong', Yii::t('podium/flash', 'Login') . ':')
                  . ' ' . Html::tag('kbd', self::DEFAULT_USERNAME)
                  . ' ' . Html::tag('strong', Yii::t('podium/flash', 'Password') . ':')
                  . ' ' . Html::tag('kbd', self::DEFAULT_USERNAME)
                  . '<br>'
                  . Html::tag('strong', Yii::t('podium/flash', 'Remember to change these credentials after first login!'), ['class' => 'text-danger'])
              );
          } catch (Exception $e) {
              $transaction->rollBack();
              return $this->returnError($e->getMessage(), __METHOD__,
                  Yii::t('podium/flash', 'Error during account creating')
              );
          }
      }
code: protected function addAdmin()
      {
          if ($this->module->userComponent !== true) {
              return $this->addInheritedAdmin();
          }
          $transaction = $this->db->beginTransaction();
          try {
              $admin = new User();
              $admin->setScenario('installation');
              $admin->setAttributes([
                  'username' => self::DEFAULT_USERNAME,
                  'status' => User::STATUS_ACTIVE,
                  'role' => User::ROLE_ADMIN,
              ], false);
              $admin->generateAuthKey();
              $admin->setPassword(self::DEFAULT_USERNAME);
              if (!$admin->save()) {
                  throw new Exception(VarDumper::dumpAsString($admin->errors));
              }
              if (!$this->authManager->assign($this->authManager->getRole(Rbac::ROLE_ADMIN), $admin->id)) {
                  throw new Exception('Error during Administrator privileges setting!');
              }
              $transaction->commit();
              return $this->returnSuccess(
                  Yii::t('podium/flash', 'Administrator account has been created.')
                  . ' ' . Html::tag('strong', Yii::t('podium/flash', 'Login') . ':')
                  . ' ' . Html::tag('kbd', self::DEFAULT_USERNAME)
                  . ' ' . Html::tag('strong', Yii::t('podium/flash', 'Password') . ':')
                  . ' ' . Html::tag('kbd', self::DEFAULT_USERNAME)
                  . '<br>'
                  . Html::tag('strong', Yii::t('podium/flash', 'Remember to change these credentials after first login!'), ['class' => 'text-danger'])
              );
          } catch (Exception $e) {
              $transaction->rollBack();
              return $this->returnError($e->getMessage(), __METHOD__,
                  Yii::t('podium/flash', 'Error during account creating')
              );
          }
      }
code_tokens: protected function addAdmin ( ) { if ( $ this -> module -> userComponent !== true ) { return $ this -> addInheritedAdmin ( ) ; } $ transaction = $ this -> db -> beginTransaction ( ) ; try { $ admin = new User ( ) ; $ admin -> setScenario ( 'installation' ) ; $ admin -> setAttributes ( [ 'username' => self :: DEFAULT_USERNAME , 'status' => User :: STATUS_ACTIVE , 'role' => User :: ROLE_ADMIN , ] , false ) ; $ admin -> generateAuthKey ( ) ; $ admin -> setPassword ( self :: DEFAULT_USERNAME ) ; if ( ! $ admin -> save ( ) ) { throw new Exception ( VarDumper :: dumpAsString ( $ admin -> errors ) ) ; } if ( ! $ this -> authManager -> assign ( $ this -> authManager -> getRole ( Rbac :: ROLE_ADMIN ) , $ admin -> id ) ) { throw new Exception ( 'Error during Administrator privileges setting!' ) ; } $ transaction -> commit ( ) ; return $ this -> returnSuccess ( Yii :: t ( 'podium/flash' , 'Administrator account has been created.' ) . ' ' . Html :: tag ( 'strong' , Yii :: t ( 'podium/flash' , 'Login' ) . ':' ) . ' ' . Html :: tag ( 'kbd' , self :: DEFAULT_USERNAME ) . ' ' . Html :: tag ( 'strong' , Yii :: t ( 'podium/flash' , 'Password' ) . ':' ) . ' ' . Html :: tag ( 'kbd' , self :: DEFAULT_USERNAME ) . '<br>' . Html :: tag ( 'strong' , Yii :: t ( 'podium/flash' , 'Remember to change these credentials after first login!' ) , [ 'class' => 'text-danger' ] ) ) ; } catch ( Exception $ e ) { $ transaction -> rollBack ( ) ; return $ this -> returnError ( $ e -> getMessage ( ) , __METHOD__ , Yii :: t ( 'podium/flash' , 'Error during account creating' ) ) ; } }
docstring: Adds Administrator account.
  @return string result message.
docstring_tokens: Adds Administrator account .