JSON
class JSON implements ResponseBuilderInterface
JSON builder.
Properties
protected mixed | $data | Data. | |
protected int | $options | JSON encode options. | |
protected string|null | $callback | Callback. | |
protected int|null | $statusCode | Status code. | |
protected string|null | $charset | Character set. |
Methods
__construct(mixed $data, int $options = 0, int|null $statusCode = null, string|null $charset = null)
Constructor.
asJsonpWith(string $callback)
Enables JSONP support.
setCharset(string $charset)
Sets the response character set.
string|null
getCharset()
Returns the response character set.
int|null
getStatus()
Returns the HTTP status code.
string
normalizeCallback(string $callback)
Ensures a valid callback name.
Details
at line 64
__construct(mixed $data, int $options = 0, int|null $statusCode = null, string|null $charset = null)
Constructor.
at line 81
JSON
asJsonpWith(string $callback)
Enables JSONP support.
at line 94
JSON
setCharset(string $charset)
Sets the response character set.
at line 106
string|null
getCharset()
Returns the response character set.
at line 117
JSON
setStatus(int $statusCode)
Sets the HTTP status code.
at line 129
int|null
getStatus()
Returns the HTTP status code.
at line 140
protected string
normalizeCallback(string $callback)
Ensures a valid callback name.