private function filterResponse(Response $response, Request $request, int $type): string
    {
        $event = new FilterResponseEvent($this->kernel, $request, $type, $response);
        $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event);
        $this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new FinishRequestEvent($this->kernel, $request, $type));

        $request->attributes->remove('data');
        $request->attributes->set('_controller', 'typo3');

        $response = $event->getResponse();

        if ($response instanceof RedirectResponse) {
            $response->send();
            $this->kernel->terminate($request, $response);

            exit();
        }

        if (\count($response->headers) || 200 !== $response->getStatusCode()) {
            $response->sendHeaders();
        }

        return $response->getContent();
    }
private function filterResponse(Response $response, Request $request, int $type): string
    {
        $event = new FilterResponseEvent($this->kernel, $request, $type, $response);
        $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event);
        $this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new FinishRequestEvent($this->kernel, $request, $type));

        $request->attributes->remove('data');
        $request->attributes->set('_controller', 'typo3');

        $response = $event->getResponse();

        if ($response instanceof RedirectResponse) {
            $response->send();
            $this->kernel->terminate($request, $response);

            exit();
        }

        if (\count($response->headers) || 200 !== $response->getStatusCode()) {
            $response->sendHeaders();
        }

        return $response->getContent();
    }
private function filterResponse ( Response $ response , Request $ request , int $ type ) : string { $ event = new FilterResponseEvent ( $ this -> kernel , $ request , $ type , $ response ) ; $ this -> dispatcher -> dispatch ( KernelEvents :: RESPONSE , $ event ) ; $ this -> dispatcher -> dispatch ( KernelEvents :: FINISH_REQUEST , new FinishRequestEvent ( $ this -> kernel , $ request , $ type ) ) ; $ request -> attributes -> remove ( 'data' ) ; $ request -> attributes -> set ( '_controller' , 'typo3' ) ; $ response = $ event -> getResponse ( ) ; if ( $ response instanceof RedirectResponse ) { $ response -> send ( ) ; $ this -> kernel -> terminate ( $ request , $ response ) ; exit ( ) ; } if ( \ count ( $ response -> headers ) || 200 !== $ response -> getStatusCode ( ) ) { $ response -> sendHeaders ( ) ; } return $ response -> getContent ( ) ; }
Filters a response object and returns the content.

@param Response $response A Response instance
@param Request  $request  An error message in case the response is not a Response object
@param int      $type     The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)

@throws \RuntimeException if the passed object is not a Response instance

@return string The filtered and resulting content
Filters a response object and returns the content .