Response
class Response implements Arrayable, Stringable
Properties
| protected int|null | $status | The HTTP response status code. |
Methods
Create a new response.
Create a new "allow" Response.
Create a new "deny" Response.
Create a new "deny" Response with a HTTP status code.
Create a new "deny" Response with a 404 HTTP status code.
Determine if the response was allowed.
Determine if the response was denied.
Get the response message.
Get the response code / reason.
Set the HTTP response status code.
Set the HTTP response status code to 404.
Get the HTTP status code.
Convert the response to an array.
Get the string representation of the message.
Details
at line 24
__construct(bool $allowed, string|null $message = '', int|string|null $code = null)
Create a new response.
at line 34
static Response
allow(string|null $message = null, int|string|null $code = null)
Create a new "allow" Response.
at line 42
static Response
deny(string|null $message = null, int|string|null $code = null)
Create a new "deny" Response.
at line 50
static Response
denyWithStatus(int $status, string|null $message = null, int|string|null $code = null)
Create a new "deny" Response with a HTTP status code.
at line 58
static Response
denyAsNotFound(string|null $message = null, int|string|null $code = null)
Create a new "deny" Response with a 404 HTTP status code.
at line 66
bool
allowed()
Determine if the response was allowed.
at line 74
bool
denied()
Determine if the response was denied.
at line 82
string|null
message()
Get the response message.
at line 90
int|string|null
code()
Get the response code / reason.
at line 100
Response
authorize()
Throw authorization exception if response was denied.
at line 114
Response
withStatus(int|null $status)
Set the HTTP response status code.
at line 124
Response
asNotFound()
Set the HTTP response status code to 404.
at line 132
int|null
status()
Get the HTTP status code.
at line 140
array
toArray()
Convert the response to an array.
at line 152
string
__toString()
Get the string representation of the message.