original_string: public function sendContent(SendResponseEvent $e)
      {
          $response = $e->getResponse();
          if (!$response instanceof ApiProblemResponse) {
              return $this;
          }
          $response->getApiProblem()->setDetailIncludesStackTrace($this->displayExceptions());
  
          /** @var Request $request */
          $request  = $this->getMvcEvent()->getRequest();
  
          /** @var Accept $accept */
          $accept = $request->getHeader('Accept');
  
          if ($accept instanceof Accept && $accept->hasMediaType('text/xml')) {
              $arrayResponse = $response->getApiProblem()->toArray();
  
              $xmlWriter = new XmlWriter();
  
              if (array_key_exists('trace', $arrayResponse)) {
                  array_walk($arrayResponse['trace'], function (&$item) {
                      unset($item['args']);
                  });
              }
              if (array_key_exists('exception_stack', $arrayResponse)) {
                  array_walk($arrayResponse['exception_stack'], function (&$item) {
                      array_walk($item['trace'], function (&$trace) {
                          unset($trace['args']);
                      });
                  });
              }
              $output = $xmlWriter->processConfig($arrayResponse);
  
              echo $output;
              $e->setContentSent();
              return $this;
          }
  
          return parent::sendHeaders($e);
      }
code: public function sendContent(SendResponseEvent $e)
      {
          $response = $e->getResponse();
          if (!$response instanceof ApiProblemResponse) {
              return $this;
          }
          $response->getApiProblem()->setDetailIncludesStackTrace($this->displayExceptions());
  
          /** @var Request $request */
          $request  = $this->getMvcEvent()->getRequest();
  
          /** @var Accept $accept */
          $accept = $request->getHeader('Accept');
  
          if ($accept instanceof Accept && $accept->hasMediaType('text/xml')) {
              $arrayResponse = $response->getApiProblem()->toArray();
  
              $xmlWriter = new XmlWriter();
  
              if (array_key_exists('trace', $arrayResponse)) {
                  array_walk($arrayResponse['trace'], function (&$item) {
                      unset($item['args']);
                  });
              }
              if (array_key_exists('exception_stack', $arrayResponse)) {
                  array_walk($arrayResponse['exception_stack'], function (&$item) {
                      array_walk($item['trace'], function (&$trace) {
                          unset($trace['args']);
                      });
                  });
              }
              $output = $xmlWriter->processConfig($arrayResponse);
  
              echo $output;
              $e->setContentSent();
              return $this;
          }
  
          return parent::sendHeaders($e);
      }
code_tokens: public function sendContent ( SendResponseEvent $ e ) { $ response = $ e -> getResponse ( ) ; if ( ! $ response instanceof ApiProblemResponse ) { return $ this ; } $ response -> getApiProblem ( ) -> setDetailIncludesStackTrace ( $ this -> displayExceptions ( ) ) ; /** @var Request $request */ $ request = $ this -> getMvcEvent ( ) -> getRequest ( ) ; /** @var Accept $accept */ $ accept = $ request -> getHeader ( 'Accept' ) ; if ( $ accept instanceof Accept && $ accept -> hasMediaType ( 'text/xml' ) ) { $ arrayResponse = $ response -> getApiProblem ( ) -> toArray ( ) ; $ xmlWriter = new XmlWriter ( ) ; if ( array_key_exists ( 'trace' , $ arrayResponse ) ) { array_walk ( $ arrayResponse [ 'trace' ] , function ( & $ item ) { unset ( $ item [ 'args' ] ) ; } ) ; } if ( array_key_exists ( 'exception_stack' , $ arrayResponse ) ) { array_walk ( $ arrayResponse [ 'exception_stack' ] , function ( & $ item ) { array_walk ( $ item [ 'trace' ] , function ( & $ trace ) { unset ( $ trace [ 'args' ] ) ; } ) ; } ) ; } $ output = $ xmlWriter -> processConfig ( $ arrayResponse ) ; echo $ output ; $ e -> setContentSent ( ) ; return $ this ; } return parent :: sendHeaders ( $ e ) ; }
docstring: Send the response content
  
  Sets the composed ApiProblem'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
  
  @throws \Zend\Config\Exception\RuntimeException
docstring_tokens: Send the response content