original_string: public function actionDeregister($id)
      {
          $id = (int)$id;
          if (Yii::$app->user->identity->getID() == $id) {
              throw new ForbiddenHttpException(Yii::t('user', 'You cannot deregister yourself.'));
          }
          $user = $this->getUser($id);
          try {
              $result = $user->deregister();
              if ($result instanceof \Exception) {
                  throw $result;
              }
          } catch (\Exception $ex) {
              throw new ServerErrorHttpException($ex->getMessage());
          }
          if ($result !== true) {
              throw new ServerErrorHttpException(Yii::t('user', 'Failed to deregister user.'));
          }
          Yii::$app->session->setFlash(Module::SESSION_KEY_RESULT, Module::RESULT_SUCCESS);
          Yii::$app->session->setFlash(Module::SESSION_KEY_MESSAGE, '(' . $user->getID() . ') ' . $this->deregisterSuccessMessage);
          return $this->redirect(['index']);
      }
code: public function actionDeregister($id)
      {
          $id = (int)$id;
          if (Yii::$app->user->identity->getID() == $id) {
              throw new ForbiddenHttpException(Yii::t('user', 'You cannot deregister yourself.'));
          }
          $user = $this->getUser($id);
          try {
              $result = $user->deregister();
              if ($result instanceof \Exception) {
                  throw $result;
              }
          } catch (\Exception $ex) {
              throw new ServerErrorHttpException($ex->getMessage());
          }
          if ($result !== true) {
              throw new ServerErrorHttpException(Yii::t('user', 'Failed to deregister user.'));
          }
          Yii::$app->session->setFlash(Module::SESSION_KEY_RESULT, Module::RESULT_SUCCESS);
          Yii::$app->session->setFlash(Module::SESSION_KEY_MESSAGE, '(' . $user->getID() . ') ' . $this->deregisterSuccessMessage);
          return $this->redirect(['index']);
      }
code_tokens: public function actionDeregister ( $ id ) { $ id = ( int ) $ id ; if ( Yii :: $ app -> user -> identity -> getID ( ) == $ id ) { throw new ForbiddenHttpException ( Yii :: t ( 'user' , 'You cannot deregister yourself.' ) ) ; } $ user = $ this -> getUser ( $ id ) ; try { $ result = $ user -> deregister ( ) ; if ( $ result instanceof \ Exception ) { throw $ result ; } } catch ( \ Exception $ ex ) { throw new ServerErrorHttpException ( $ ex -> getMessage ( ) ) ; } if ( $ result !== true ) { throw new ServerErrorHttpException ( Yii :: t ( 'user' , 'Failed to deregister user.' ) ) ; } Yii :: $ app -> session -> setFlash ( Module :: SESSION_KEY_RESULT , Module :: RESULT_SUCCESS ) ; Yii :: $ app -> session -> setFlash ( Module :: SESSION_KEY_MESSAGE , '(' . $ user -> getID ( ) . ') ' . $ this -> deregisterSuccessMessage ) ; return $ this -> redirect ( [ 'index' ] ) ; }
docstring: Deregister User.
  @param string $id User ID.
  @return string
  @throws ServerErrorHttpException
  @throws ForbiddenHttpException
docstring_tokens: Deregister User .