/**
  * @param Request $request
  * @param SymfonyResponse $response
  * @return SymfonyResponse
  */
 public function transformEarly(Request $request, SymfonyResponse $response)
 {
     $responseModel = $response->getContent();
     if (!$responseModel instanceof ResponseModel) {
         $responseModel = ResponseModelFactory::createFromContent($response);
     }
     $response->setStatusCode($responseModel->getStatusCode());
     $this->forceStatusCodeHttpOK($request, $response, $responseModel);
     $response = $this->createSerializedResponse($request, $response, $responseModel);
     return $response;
 }
 /**
  * @param $data
  * @return RestApiResponse
  */
 protected function createRestApiResponse($data)
 {
     return new RestApiResponse(ResponseModelFactory::createFactory()->createFromContent($data));
 }
 /**
  * @param $content
  * @return ResponseModel
  */
 protected function createResponseModel($content)
 {
     return ResponseModelFactory::createFactory()->createFromContent($content);
 }
 /**
  * @return ResponseModelFactory
  */
 public function getResponseModelFactory()
 {
     if (!isset($this->responseModelFactory)) {
         $this->responseModelFactory = ResponseModelFactory::createFactory();
     }
     return $this->responseModelFactory;
 }