CliController
extends AbstractController
in package
Table of Contents
Properties
- $catchControllerOutput : bool
- Catch controller output when running it
- $options : array<string|int, mixed>
- Running options for this controller
- $route : ControllerRoute|null
- The route calling this controller A controller could be called without any route and any request This variable comes to get the route without any request
- $request : InputRequest|null
- The request calling this controller
Methods
- __construct() : mixed
- Controller constructor
- __toString() : string
- Get this controller as string
- fillValues() : void
- Fill array with default values
- getOption() : string|mixed
- Get an option by $key
- getRequest() : InputRequest|null
- Get the request
- getRoute() : ControllerRoute|null
- Get the route
- getRouteName() : string|null
- Get the route name
- getValues() : array<string|int, mixed>
- Get parameter values of this controller Use it to generate routes (as for menus) with path parameters & you can get the current context
- postRun() : OutputResponse|null
- After running the controller
- prepare() : OutputResponse|null
- Prepare environment for this route
- preRun() : OutputResponse|null
- Before running controller
- print() : void
- Print text
- printError() : void
- Print Error Line
- printLine() : void
- Print text line
- process() : OutputResponse|null
- Process the $request
- processException() : CliResponse
- processUserException() : mixed
- Process the given UserException
- render() : mixed
- Render the given $layout in $response using $values
- requestInputLine() : string
- Request a input line to user
- run() : OutputResponse
- Run this controller
- setOption() : AbstractController
- Set an option by $key
- setOptions() : AbstractController
- Set an option by $key
Properties
$catchControllerOutput
Catch controller output when running it
protected
bool
$catchControllerOutput
= false
$options
Running options for this controller
protected
array<string|int, mixed>
$options
= []
$route
The route calling this controller A controller could be called without any route and any request This variable comes to get the route without any request
protected
ControllerRoute|null
$route
= null
$request
The request calling this controller
private
InputRequest|null
$request
= null
Methods
__construct()
Controller constructor
public
__construct(ControllerRoute|null $route, array<string|int, mixed> $options) : mixed
Parameters
- $route : ControllerRoute|null
- $options : array<string|int, mixed>
__toString()
Get this controller as string
public
__toString() : string
Return values
stringfillValues()
Fill array with default values
public
fillValues([array<string|int, mixed> &$values = [] ]) : void
Parameters
- $values : array<string|int, mixed> = []
getOption()
Get an option by $key
public
getOption(string $key[, mixed|null $default = null ]) : string|mixed
Parameters
- $key : string
- $default : mixed|null = null
Return values
string|mixedgetRequest()
Get the request
public
getRequest() : InputRequest|null
Return values
InputRequest|nullgetRoute()
Get the route
public
getRoute() : ControllerRoute|null
Return values
ControllerRoute|nullgetRouteName()
Get the route name
public
getRouteName() : string|null
Return values
string|nullgetValues()
Get parameter values of this controller Use it to generate routes (as for menus) with path parameters & you can get the current context
public
getValues() : array<string|int, mixed>
Return values
array<string|int, mixed>postRun()
After running the controller
public
postRun(mixed $request, mixed $response) : OutputResponse|null
Parameters
- $request : mixed
- $response : mixed
Tags
Return values
OutputResponse|nullprepare()
Prepare environment for this route
public
prepare(mixed $request) : OutputResponse|null
Parameters
- $request : mixed
Return values
OutputResponse|nullpreRun()
Before running controller
public
preRun(mixed $request) : OutputResponse|null
Parameters
- $request : mixed
Return values
OutputResponse|nullprint()
Print text
public
print([string|null $text = null ]) : void
Parameters
- $text : string|null = null
printError()
Print Error Line
public
printError(mixed $text) : void
Parameters
- $text : mixed
printLine()
Print text line
public
printLine([string|null $text = null ]) : void
Parameters
- $text : string|null = null
process()
Process the $request
public
process() : OutputResponse|null
Tags
Return values
OutputResponse|nullprocessException()
public
processException(Throwable $exception[, array<string|int, mixed> $values = [] ]) : CliResponse
Parameters
- $exception : Throwable
- $values : array<string|int, mixed> = []
Return values
CliResponseprocessUserException()
Process the given UserException
public
processUserException(UserException $exception[, array<string|int, mixed> $values = [] ]) : mixed
Parameters
- $exception : UserException
- $values : array<string|int, mixed> = []
render()
Render the given $layout in $response using $values
public
render(OutputResponse $response, string $layout[, array<string|int, mixed> $values = [] ]) : mixed
Parameters
- $response : OutputResponse
- $layout : string
- $values : array<string|int, mixed> = []
Return values
mixed —The $response
requestInputLine()
Request a input line to user
public
requestInputLine([string|null $text = null ][, bool $return = true ]) : string
Parameters
- $text : string|null = null
- $return : bool = true
Return values
stringrun()
Run this controller
public
abstract run(mixed $request) : OutputResponse
Parameters
- $request : mixed
Return values
OutputResponsesetOption()
Set an option by $key
public
setOption(string $key, mixed $value) : AbstractController
Parameters
- $key : string
- $value : mixed
Return values
AbstractControllersetOptions()
Set an option by $key
public
setOptions(array<string|int, mixed> $options) : AbstractController
Parameters
- $options : array<string|int, mixed>