/**
  * Send the response content
  *
  * Sets the composed Problem's flag for including the stack trace in the
  * detail based on the display exceptions flag, and then sends content.
  *
  * @param SendResponseEvent $e
  * @return self
  */
 public function sendContent(SendResponseEvent $e)
 {
     $response = $e->getResponse();
     if (!$response instanceof ProblemResponse) {
         return $this;
     }
     $response->getApiProblem()->setDetailIncludesStackTrace($this->displayExceptions());
     return parent::sendContent($e);
 }
 /**
  * Send HTTP response headers.
  *
  * If an application response is composed, and is an HTTP response, merges
  * its headers with the ApiProblemResponse headers prior to sending them.
  *
  * @param SendResponseEvent $e
  *
  * @return self
  */
 public function sendHeaders(SendResponseEvent $e)
 {
     $response = $e->getResponse();
     if (!$response instanceof ApiProblemResponse) {
         return $this;
     }
     if ($this->applicationResponse instanceof HttpResponse) {
         $this->mergeHeaders($this->applicationResponse, $response);
     }
     return parent::sendHeaders($e);
 }
Example #3
0
 /**
  * Renders the Response object.
  *
  * @param Response $response Rcm Response Object
  *
  * @return void
  */
 protected function renderResponse(Response $response)
 {
     $sendEvent = new SendResponseEvent();
     $sendEvent->setResponse($response);
     $this->responseSender->__invoke($sendEvent);
 }