CliResponse
extends OutputResponse
in package
Table of Contents
Properties
- $body : string|null
- The HTML body of the response
- $code : int
- The returned response code
- $controllerOutput : string|null
- The output of the controller when running it
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Get this response as string
- collectFrom() : void
- Collect response data from parameters
- generateFromException() : static
- Generate CliResponse from Exception
- generateFromUserException() : static
- Generate CliResponse from UserException
- getBody() : string|null
- Get the body
- getCode() : int
- Get the code
- getControllerOutput() : string|null
- Get the controller output
- isSuccess() : bool
- process() : void
- Process the response
- setBody() : CliResponse
- Set the body
- setCode() : CliResponse
- Set the code
- setControllerOutput() : void
- Set the controller output
Properties
$body
The HTML body of the response
protected
string|null
$body
= null
$code
The returned response code
protected
int
$code
$controllerOutput
The output of the controller when running it
protected
string|null
$controllerOutput
= null
Methods
__construct()
Constructor
public
__construct([int|string $code = 0 ][, string|null $body = null ]) : mixed
Parameters
- $code : int|string = 0
- $body : string|null = null
__toString()
Get this response as string
public
__toString() : string
Return values
stringcollectFrom()
Collect response data from parameters
public
collectFrom(string $layout[, array<string|int, mixed> $values = [] ]) : void
Parameters
- $layout : string
- $values : array<string|int, mixed> = []
generateFromException()
Generate CliResponse from Exception
public
static generateFromException(Exception $exception[, array<string|int, mixed> $values = [] ]) : static
Parameters
- $exception : Exception
- $values : array<string|int, mixed> = []
Return values
staticgenerateFromUserException()
Generate CliResponse from UserException
public
static generateFromUserException(UserException $exception[, array<string|int, mixed> $values = [] ]) : static
Parameters
- $exception : UserException
- $values : array<string|int, mixed> = []
Return values
staticgetBody()
Get the body
public
getBody() : string|null
Return values
string|nullgetCode()
Get the code
public
getCode() : int
Return values
intgetControllerOutput()
Get the controller output
public
getControllerOutput() : string|null
Return values
string|nullisSuccess()
public
isSuccess() : bool
Return values
boolprocess()
Process the response
public
process() : void
setBody()
Set the body
public
setBody(string|null $body) : CliResponse
Parameters
- $body : string|null
Return values
CliResponsesetCode()
Set the code
public
setCode(int $code) : CliResponse
Parameters
- $code : int
Return values
CliResponsesetControllerOutput()
Set the controller output
public
setControllerOutput(string $controllerOutput) : void
Parameters
- $controllerOutput : string