Nextcloud PHP API (master)

JSONResponse extends Response
in package

A renderer for JSON calls

Tags
since
6.0.0
template

S of int

template

H of array<string, mixed>

template-covariant

T of array|object|\stdClass|\JsonSerializable

template-extends

Response<int, array<string, mixed>>

Table of Contents

Properties

$data  : T
response data

Methods

__construct()  : mixed
constructor of JSONResponse
getData()  : T
render()  : string
Returns the rendered json
setData()  : JSONResponse
Sets values in the data json array

Properties

Methods

__construct()

constructor of JSONResponse

public __construct([T $data = [] ][, S $statusCode = Http::STATUS_OK ][, H $headers = [] ]) : mixed
Parameters
$data : T = []

the object or array that should be transformed

$statusCode : S = Http::STATUS_OK

the Http status code, defaults to 200

$headers : H = []
Tags
since
6.0.0

getData()

public getData() : T
Tags
since
6.0.0
Return values
T

the data

render()

Returns the rendered json

public render() : string
Tags
since
6.0.0
throws
Exception

If data could not get encoded

Return values
string

the rendered json

setData()

Sets values in the data json array

public setData(T $data) : JSONResponse
Parameters
$data : T

an array or object which will be transformed to JSON

Tags
psalm-suppress

InvalidTemplateParam

since
6.0.0
  • return value was added in 7.0.0
Return values
JSONResponse

Reference to this object


        
On this page

Search results