[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/vendor/symfony/http-foundation/ -> JsonResponse.php (summary)

(no description)

File Size: 235 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

JsonResponse:: (9 methods):
  __construct()
  create()
  fromJsonString()
  setCallback()
  setJson()
  setData()
  getEncodingOptions()
  setEncodingOptions()
  update()


Class: JsonResponse  - X-Ref

Response represents an HTTP response in JSON format.

Note that this class does not force the returned JSON content to be an
object. It is however recommended that you do return an object as it
protects yourself against XSSI and JSON-JavaScript Hijacking.

__construct($data = null, $status = 200, $headers = [], $json = false)   X-Ref

param: mixed $data    The response data
param: int   $status  The response status code
param: array $headers An array of response headers
param: bool  $json    If the data is already a JSON string

create($data = null, $status = 200, $headers = [])   X-Ref
Factory method for chainability.

Example:

return JsonResponse::create(['key' => 'value'])
->setSharedMaxAge(300);

return: static
param: mixed $data    The JSON response data
param: int   $status  The response status code
param: array $headers An array of response headers

fromJsonString($data = null, $status = 200, $headers = [])   X-Ref
Factory method for chainability.

Example:

return JsonResponse::fromJsonString('{"key": "value"}')
->setSharedMaxAge(300);

return: static
param: string|null $data    The JSON response string
param: int         $status  The response status code
param: array       $headers An array of response headers

setCallback($callback = null)   X-Ref
Sets the JSONP callback.

return: $this
param: string|null $callback The JSONP callback or null to use none

setJson($json)   X-Ref
Sets a raw string containing a JSON document to be sent.

return: $this
param: string $json

setData($data = [])   X-Ref
Sets the data to be sent as JSON.

return: $this
param: mixed $data

getEncodingOptions()   X-Ref
Returns options used while encoding data to JSON.

return: int

setEncodingOptions($encodingOptions)   X-Ref
Sets options used while encoding data to JSON.

return: $this
param: int $encodingOptions

update()   X-Ref
Updates the content and headers according to the JSON data and callback.

return: $this



Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1