original_string: public function actionUploadImage(): Response
      {
          $model = Yii::createObject($this->attachmentModelClass);
          $model->file = UploadedFile::getInstanceByName('file');
  
          if (!$model->save()) {
              throw new UnprocessableEntityHttpException($model->getFirstError('file'));
          }
  
          return $this->asJson([
              'link' => $model->getFileUrl('origin'),
          ]);
      }
code: public function actionUploadImage(): Response
      {
          $model = Yii::createObject($this->attachmentModelClass);
          $model->file = UploadedFile::getInstanceByName('file');
  
          if (!$model->save()) {
              throw new UnprocessableEntityHttpException($model->getFirstError('file'));
          }
  
          return $this->asJson([
              'link' => $model->getFileUrl('origin'),
          ]);
      }
code_tokens: public function actionUploadImage ( ) : Response { $ model = Yii :: createObject ( $ this -> attachmentModelClass ) ; $ model -> file = UploadedFile :: getInstanceByName ( 'file' ) ; if ( ! $ model -> save ( ) ) { throw new UnprocessableEntityHttpException ( $ model -> getFirstError ( 'file' ) ) ; } return $ this -> asJson ( [ 'link' => $ model -> getFileUrl ( 'origin' ) , ] ) ; }
docstring: Upload an image
  
  @return Response
  
  @throws UnprocessableEntityHttpException
docstring_tokens: Upload an image