protected function deliver(Response $response)
    {
        if (!$response->isSuccessful()) {
            throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $this->requestStack->getCurrentRequest()->getUri(), $response->getStatusCode()));
        }

        if (!$response instanceof StreamedResponse) {
            return $response->getContent();
        }

        $response->sendContent();
    }
protected function deliver(Response $response)
    {
        if (!$response->isSuccessful()) {
            throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $this->requestStack->getCurrentRequest()->getUri(), $response->getStatusCode()));
        }

        if (!$response instanceof StreamedResponse) {
            return $response->getContent();
        }

        $response->sendContent();
    }
protected function deliver ( Response $ response ) { if ( ! $ response -> isSuccessful ( ) ) { throw new \ RuntimeException ( sprintf ( 'Error when rendering "%s" (Status code is %s).' , $ this -> requestStack -> getCurrentRequest ( ) -> getUri ( ) , $ response -> getStatusCode ( ) ) ) ; } if ( ! $ response instanceof StreamedResponse ) { return $ response -> getContent ( ) ; } $ response -> sendContent ( ) ; }
Delivers the Response as a string.

When the Response is a StreamedResponse, the content is streamed immediately
instead of being returned.

@return string|null The Response content or null when the Response is streamed

@throws \RuntimeException when the Response is not successful
Delivers the Response as a string .