original_string: public function actionCreate()
      {
          $model = new Client();
          if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
              Yii::$app->response->format = Response::FORMAT_JSON;
              return ActiveForm::validate($model);
          } else if ($model->load(Yii::$app->request->post()) && $model->save()) {
              Yii::$app->getSession()->setFlash('success', Yii::t('oauth2', 'Successful operation'));
              return $this->redirect(['view', 'id' => $model->client_id]);
          } else {
              return $this->render('create', [
                  'model' => $model,
              ]);
          }
      }
code: public function actionCreate()
      {
          $model = new Client();
          if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
              Yii::$app->response->format = Response::FORMAT_JSON;
              return ActiveForm::validate($model);
          } else if ($model->load(Yii::$app->request->post()) && $model->save()) {
              Yii::$app->getSession()->setFlash('success', Yii::t('oauth2', 'Successful operation'));
              return $this->redirect(['view', 'id' => $model->client_id]);
          } else {
              return $this->render('create', [
                  'model' => $model,
              ]);
          }
      }
code_tokens: public function actionCreate ( ) { $ model = new Client ( ) ; if ( Yii :: $ app -> request -> isAjax && $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { Yii :: $ app -> response -> format = Response :: FORMAT_JSON ; return ActiveForm :: validate ( $ model ) ; } else if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> getSession ( ) -> setFlash ( 'success' , Yii :: t ( 'oauth2' , 'Successful operation' ) ) ; return $ this -> redirect ( [ 'view' , 'id' => $ model -> client_id ] ) ; } else { return $ this -> render ( 'create' , [ 'model' => $ model , ] ) ; } }
docstring: Creates a new Rest model.
  If creation is successful, the browser will be redirected to the 'view' page.
  @return mixed
docstring_tokens: Creates a new Rest model . If creation is successful the browser will be redirected to the view page .