class JsonPresenter implements Presentable, Jsonable

JsonPresenter

  • API 로 출력할 때 출력방식을 JSON 으로 선택한 경우 동작

Properties

protected Presenter $presenter
protected string $id skin output id
protected array $data The array of view data.

Methods

__construct(Presenter $presenter)

Create a new Renderer instance.

static string
format()

format

array
convert(mixed $data, mixed $key = null)

data convert to array

mixed|string
getObjectToArray(mixed $data)

get object to array

string
toJson(int $options)

return json format string

string
render()

return json format string

array
toArray()

Get the instance as an array.

Details

at line 62
__construct(Presenter $presenter)

Create a new Renderer instance.

Parameters

Presenter $presenter presenter

at line 72
static string format()

format

Return Value

string

at line 84
private array convert(mixed $data, mixed $key = null)

data convert to array

Parameters

mixed $data data
mixed $key key

Return Value

array

at line 107
private mixed|string getObjectToArray(mixed $data)

get object to array

Parameters

mixed $data data

Return Value

mixed|string

at line 128
string toJson(int $options)

return json format string

Parameters

int $options options

Return Value

string

at line 139
string render()

return json format string

Return Value

string

at line 149
array toArray()

Get the instance as an array.

Return Value

array