Delivers the Response as a string.
When the Response is a StreamedResponse, the content is streamed immediately instead of being returned.
Response $response A Response instance:
string|null The Response content or null when the Response is streamed
\RuntimeException when the Response is not successful
protected function deliver(Response $response) {
if (!$response
->isSuccessful()) {
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $this->request
->getUri(), $response
->getStatusCode()));
}
if (!$response instanceof StreamedResponse) {
return $response
->getContent();
}
$response
->sendContent();
}