setDI() setDI(\Anax\DI\Anax\DI\DIInterface $di) : self Set the service container to use Parameters \Anax\DI\Anax\DI\DIInterface $di a service container Returns self
setStatusCode() setStatusCode( $value) : self Set status code to be sent as part of headers. Parameters $value Returns self
getStatusCode() getStatusCode() : integer Get status code to be sent as part of headers. Returns integer — value as status code or null if not set.
addHeader() addHeader(string $header) : self Set headers. Parameters string $header type of header to set Returns self
checkIfHeadersAlreadySent() checkIfHeadersAlreadySent() : void Check if headers are already sent and throw exception if it has, but ignore when running in cli mode. Throws \Anax\Response\Exception
setBody() setBody(callable|string $body) : self Set the body. Parameters callable|string $body either a string or a callable that can generate the body. Returns self
send() send(integer $statusCode = null) : self Send response with an optional statuscode. Parameters integer $statusCode optional statuscode to send. Returns self
sendJson() sendJson(mixed $data, integer $statusCode = null) : self Send JSON response with an optional statuscode. Parameters mixed $data to be encoded as json. integer $statusCode optional statuscode to send. Returns self
setJsonBody() setJsonBody(mixed $data) : self Set body with JSON data. Parameters mixed $data to be encoded as json. Returns self
redirect() redirect(string $url) : void Redirect to another page and creating an url from the argument. Parameters string $url to redirect to