public function Response::setContent in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::setContent()
Sets the response content.
Valid types are strings, numbers, null, and objects that implement a __toString() method.
Parameters
mixed $content Content that can be cast to string:
Return value
Throws
\UnexpectedValueException
6 calls to Response::setContent()
- HtmlResponse::setContent in core/
lib/ Drupal/ Core/ Render/ HtmlResponse.php - Sets the response content.
- JsonResponse::update in vendor/
symfony/ http-foundation/ JsonResponse.php - Updates the content and headers according to the JSON data and callback.
- RedirectResponse::setTargetUrl in vendor/
symfony/ http-foundation/ RedirectResponse.php - Sets the redirect target of this response.
- Response::prepare in vendor/
symfony/ http-foundation/ Response.php - Prepares the Response before it is sent to the client.
- Response::setNotModified in vendor/
symfony/ http-foundation/ Response.php - Modifies the response so that it conforms to the rules defined for a 304 status code.
3 methods override Response::setContent()
- BinaryFileResponse::setContent in vendor/
symfony/ http-foundation/ BinaryFileResponse.php - HtmlResponse::setContent in core/
lib/ Drupal/ Core/ Render/ HtmlResponse.php - Sets the response content.
- StreamedResponse::setContent in vendor/
symfony/ http-foundation/ StreamedResponse.php
File
- vendor/
symfony/ http-foundation/ Response.php, line 392
Class
- Response
- Response represents an HTTP response.
Namespace
Symfony\Component\HttpFoundationCode
public function setContent($content) {
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array(
$content,
'__toString',
))) {
throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content)));
}
$this->content = (string) $content;
return $this;
}