Response
class Response implements Arrayable, Stringable (View source)
Properties
Methods
__construct(bool $allowed, string|null $message = '', mixed $code = null)
Create a new response.
static Response
allow(string|null $message = null, mixed $code = null)
Create a new "allow" Response.
static Response
denyWithStatus(int $status, string|null $message = null, mixed $code = null)
Create a new "deny" Response with a HTTP status code.
static Response
denyAsNotFound(string|null $message = null, mixed $code = null)
Create a new "deny" Response with a 404 HTTP status code.
bool
allowed()
Determine if the response was allowed.
bool
denied()
Determine if the response was denied.
string|null
message()
Get the response message.
mixed
code()
Get the response code / reason.
$this
withStatus(null|int $status)
Set the HTTP response status code.
$this
asNotFound()
Set the HTTP response status code to 404.
int|null
status()
Get the HTTP status code.
toArray()
Convert the response to an array.
string
__toString()
Get the string representation of the message.
Details
static Response
allow(string|null $message = null, mixed $code = null)
Create a new "allow" Response.
static Response
denyWithStatus(int $status, string|null $message = null, mixed $code = null)
Create a new "deny" Response with a HTTP status code.
static Response
denyAsNotFound(string|null $message = null, mixed $code = null)
Create a new "deny" Response with a 404 HTTP status code.