class Response implements ResponseInterface (View source)

Methods

static Response
getInstance()

Get response

string
getContent()

Get response message

int
getCode()

Get status code

array
getHeaders()

Get headers

setContent(string $content)

Get response message

withHeaders(array $headers)

Get headers

addHeader(string $key, string $value)

Modify http headers

string
download(string $file, null $filename = null, string $disposition = 'attachment', array $headers = [])

Download the given file as an argument

mixed
status(int $code)

Modify http headers

string
json(mixed $data, int $code = 200, array $headers = [])

JSON response

string
send(string|array|stdClass $data, int $code = 200, array $headers = [])

Equivalent to an echo, except that it ends the application

string
render($template, array $data = [], int $code = 200, array $headers = [])

Make view rendering

AccessControl
serverAccessControl()

Get accessControl instance

string
sendContent()

No description

Details

static Response getInstance()

Get response

Return Value

Response

string getContent()

Get response message

Return Value

string

int getCode()

Get status code

Return Value

int

array getHeaders()

Get headers

Return Value

array

Response setContent(string $content)

Get response message

Parameters

string $content

Return Value

Response

Response withHeaders(array $headers)

Get headers

Parameters

array $headers

Return Value

Response

Response addHeader(string $key, string $value)

Modify http headers

Parameters

string $key
string $value

Return Value

Response

string download(string $file, null $filename = null, string $disposition = 'attachment', array $headers = [])

Download the given file as an argument

Parameters

string $file
null $filename
string $disposition
array $headers

Return Value

string

mixed status(int $code)

Modify http headers

Parameters

int $code

Return Value

mixed

string json(mixed $data, int $code = 200, array $headers = [])

JSON response

Parameters

mixed $data
int $code
array $headers

Return Value

string

string send(string|array|stdClass $data, int $code = 200, array $headers = [])

Equivalent to an echo, except that it ends the application

Parameters

string|array|stdClass $data
int $code
array $headers

Return Value

string

string render($template, array $data = [], int $code = 200, array $headers = [])

Make view rendering

Parameters

$template
array $data
int $code
array $headers

Return Value

string

Exceptions

AccessControl serverAccessControl()

Get accessControl instance

Return Value

AccessControl

string sendContent()

No description

Return Value

string