public function Response::setContent

Sets the response content.

Valid types are strings, numbers, and objects that implement a __toString() method.

@api

Parameters

mixed $content:

Return value

Response

5 calls to Response::setContent()
JsonResponse::update in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php
Updates the content and headers according to the json data and callback.
RedirectResponse::setTargetUrl in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php
Sets the redirect target of this response.
Response::prepare in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php
Prepares the Response before it is sent to the client.
Response::setNotModified in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php
Modifies the response so that it conforms to the rules defined for a 304 status code.
Response::__construct in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php
Constructor.
1 method overrides Response::setContent()
StreamedResponse::setContent in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php, line 330

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function setContent($content) {
  if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array(
    $content,
    '__toString',
  ))) {
    throw new \UnexpectedValueException('The Response content must be a string or object implementing __toString(), "' . gettype($content) . '" given.');
  }
  $this->content = (string) $content;
  return $this;
}