original_string: public function sendHeaders(SendResponseEvent $e)
      {
          $response = $e->getResponse();
          if (!$response instanceof ApiProblemResponse) {
              return $this;
          }
  
          /** @var Request $request */
          $request  = $this->getMvcEvent()->getRequest();
  
          /** @var Accept $accept */
          $accept = $request->getHeader('Accept');
  
          if ($accept instanceof Accept && $accept->hasMediaType('text/xml')) {
              $headers = $response->getHeaders();
  
              if ($headers->has('content-type')) {
                  $contentTypeHeader = $headers->get('content-type');
                  $headers->removeHeader($contentTypeHeader);
              }
              $headers->addHeaderLine('content-type', 'text/xml');
  
              if ($this->applicationResponse instanceof HttpResponse) {
                  $this->mergeHeaders($this->applicationResponse, $response);
              }
          }
  
          return parent::sendHeaders($e);
      }
code: public function sendHeaders(SendResponseEvent $e)
      {
          $response = $e->getResponse();
          if (!$response instanceof ApiProblemResponse) {
              return $this;
          }
  
          /** @var Request $request */
          $request  = $this->getMvcEvent()->getRequest();
  
          /** @var Accept $accept */
          $accept = $request->getHeader('Accept');
  
          if ($accept instanceof Accept && $accept->hasMediaType('text/xml')) {
              $headers = $response->getHeaders();
  
              if ($headers->has('content-type')) {
                  $contentTypeHeader = $headers->get('content-type');
                  $headers->removeHeader($contentTypeHeader);
              }
              $headers->addHeaderLine('content-type', 'text/xml');
  
              if ($this->applicationResponse instanceof HttpResponse) {
                  $this->mergeHeaders($this->applicationResponse, $response);
              }
          }
  
          return parent::sendHeaders($e);
      }
code_tokens: public function sendHeaders ( SendResponseEvent $ e ) { $ response = $ e -> getResponse ( ) ; if ( ! $ response instanceof ApiProblemResponse ) { return $ this ; } /** @var Request $request */ $ request = $ this -> getMvcEvent ( ) -> getRequest ( ) ; /** @var Accept $accept */ $ accept = $ request -> getHeader ( 'Accept' ) ; if ( $ accept instanceof Accept && $ accept -> hasMediaType ( 'text/xml' ) ) { $ headers = $ response -> getHeaders ( ) ; if ( $ headers -> has ( 'content-type' ) ) { $ contentTypeHeader = $ headers -> get ( 'content-type' ) ; $ headers -> removeHeader ( $ contentTypeHeader ) ; } $ headers -> addHeaderLine ( 'content-type' , 'text/xml' ) ; if ( $ this -> applicationResponse instanceof HttpResponse ) { $ this -> mergeHeaders ( $ this -> applicationResponse , $ response ) ; } } return parent :: sendHeaders ( $ e ) ; }
docstring: 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
  
  @throws \Zend\Http\Exception\InvalidArgumentException
docstring_tokens: Send HTTP response headers