JsonResponse
class JsonResponse extends JsonResponse
Traits
Properties
mixed | $original | The original content of the response. |
from ResponseTrait |
Exception|null | $exception | The exception that triggered the error response (if applicable). |
from ResponseTrait |
Methods
Set a header on the Response.
Constructor.
Sets the JSONP callback.
Get the json_decoded data from the response.
{@inheritdoc}
Determine if an error occurred during JSON encoding.
{@inheritdoc}
Determine if a JSON encoding option is set.
Details
in
ResponseTrait at line 29
int
status()
Get the status code for the response.
in
ResponseTrait at line 39
string
content()
Get the content of the response.
in
ResponseTrait at line 49
mixed
getOriginalContent()
Get the original response content.
in
ResponseTrait at line 62
$this
header(string $key, array|string $values, bool $replace = true)
Set a header on the Response.
in
ResponseTrait at line 75
$this
withHeaders(array $headers)
Add an array of headers to the response.
in
ResponseTrait at line 90
$this
cookie(Cookie|mixed $cookie)
Add a cookie to the response.
in
ResponseTrait at line 101
$this
withCookie(Cookie|mixed $cookie)
Add a cookie to the response.
in
ResponseTrait at line 118
$this
withException(Exception $e)
Set the exception to attach to the response.
in
ResponseTrait at line 130
throwResponse()
Throws the response in a HttpResponseException instance.
at line 23
__construct(mixed $data = null, int $status = 200, array $headers = [], int $options = 0)
Constructor.
at line 36
$this
withCallback(string|null $callback = null)
Sets the JSONP callback.
at line 48
mixed
getData(bool $assoc = false, int $depth = 512)
Get the json_decoded data from the response.
at line 56
setData($data = [])
{@inheritdoc}
at line 83
protected bool
hasValidJson(int $jsonError)
Determine if an error occurred during JSON encoding.
at line 93
setEncodingOptions($options)
{@inheritdoc}
at line 106
bool
hasEncodingOption(int $option)
Determine if a JSON encoding option is set.