InputRequest
in package
Table of Contents
Properties
- $input : array<string|int, mixed>|string|null
- The input (like stdin)
- $mainRequest : static|null
- The current main request
- $parameters : array<string|int, mixed>
- The input parameters (inline parameters)
- $path : string
- The path
- $pathValues : array<string|int, mixed>
- The values in path
- $route : ControllerRoute|null
- The found route for this request A request could exist without any route (e.g. Route initialization failed)
Methods
- __construct() : mixed
- Constructor
- cloneWithPath() : InputRequest
- Clone this request using another path (expecting a sub path)
- findFirstMatchingRoute() : array<string|int, mixed>
- Find a matching route according to the request
- getController() : AbstractController
- Get running controller
- getDefaultController() : mixed
- getInput() : array<string|int, mixed>
- Get input
- getInputValue() : mixed
- Get the input by $key, assuming $default value
- getMainRequest() : InputRequest|null
- Get the main input request
- getOption() : mixed
- Get the option by $key, assuming $default value
- getParameter() : mixed
- Get the parameter by $key, assuming $default value
- getParameters() : array<string|int, mixed>
- Get all parameters
- getPath() : string
- Get the path
- getRoute() : ControllerRoute|null
- Get the route to this request
- getRouteClass() : string
- getRouteName() : string
- Get the route name to this request
- getRoutes() : array<string|int, ControllerRoute>
- Get all available routes
- hasInput() : bool
- Test if request has any input
- hasInputValue() : bool
- Test if input $key exists in this request
- hasParameter() : bool
- Test if parameter $key exists in this request
- matchPath() : string
- Test path is matching regex
- process() : OutputResponse
- Process the request by finding a route and processing it
- processRoute() : OutputResponse
- Process the given route
- redirect() : RedirectHttpResponse|null
- Redirect response to $route
- setRoute() : InputRequest
- Set the route to this request
- setInput() : InputRequest
- Set the input
- setParameters() : InputRequest
- Set the parameters
- setPath() : InputRequest
- Set the path
Properties
$input
The input (like stdin)
protected
array<string|int, mixed>|string|null
$input
$mainRequest
The current main request
protected
static static|null
$mainRequest
= null
$parameters
The input parameters (inline parameters)
protected
array<string|int, mixed>
$parameters
$path
The path
protected
string
$path
$pathValues
The values in path
protected
array<string|int, mixed>
$pathValues
$route
The found route for this request A request could exist without any route (e.g. Route initialization failed)
protected
ControllerRoute|null
$route
= null
Methods
__construct()
Constructor
public
__construct(string $path, array<string|int, mixed> $parameters, array<string|int, mixed>|string|null $input) : mixed
Parameters
- $path : string
- $parameters : array<string|int, mixed>
- $input : array<string|int, mixed>|string|null
cloneWithPath()
Clone this request using another path (expecting a sub path)
public
cloneWithPath(string $path) : InputRequest
Parameters
- $path : string
Return values
InputRequestfindFirstMatchingRoute()
Find a matching route according to the request
public
findFirstMatchingRoute() : array<string|int, mixed>
Return values
array<string|int, mixed>getController()
Get running controller
public
getController() : AbstractController
Return values
AbstractControllergetDefaultController()
public
abstract static getDefaultController() : mixed
getInput()
Get input
public
getInput() : array<string|int, mixed>
Return values
array<string|int, mixed>getInputValue()
Get the input by $key, assuming $default value
public
getInputValue(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
getMainRequest()
Get the main input request
public
static getMainRequest() : InputRequest|null
Return values
InputRequest|nullgetOption()
Get the option by $key, assuming $default value
public
getOption(string $key[, string|null $short = null ][, mixed|null $default = null ]) : mixed
Parameters
- $key : string
- $short : string|null = null
- $default : mixed|null = null
getParameter()
Get the parameter by $key, assuming $default value
public
getParameter(string $key[, mixed|null $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed|null = null
getParameters()
Get all parameters
public
getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>getPath()
Get the path
public
getPath() : string
Return values
stringgetRoute()
Get the route to this request
public
getRoute() : ControllerRoute|null
Return values
ControllerRoute|nullgetRouteClass()
public
abstract static getRouteClass() : string
Return values
stringgetRouteName()
Get the route name to this request
public
getRouteName() : string
Return values
stringgetRoutes()
Get all available routes
public
abstract getRoutes() : array<string|int, ControllerRoute>
Return values
array<string|int, ControllerRoute>hasInput()
Test if request has any input
public
hasInput() : bool
Return values
boolhasInputValue()
Test if input $key exists in this request
public
hasInputValue(string $key) : bool
Parameters
- $key : string
Return values
boolhasParameter()
Test if parameter $key exists in this request
public
hasParameter(string $key) : bool
Parameters
- $key : string
Return values
boolmatchPath()
Test path is matching regex
public
matchPath(string $regex, array<string|int, mixed>|null &$matches) : string
Parameters
- $regex : string
- $matches : array<string|int, mixed>|null
Return values
stringprocess()
Process the request by finding a route and processing it
public
process() : OutputResponse
Tags
Return values
OutputResponseprocessRoute()
Process the given route
public
processRoute(ControllerRoute $route, array<string|int, mixed> $values) : OutputResponse
Parameters
- $route : ControllerRoute
- $values : array<string|int, mixed>
Tags
Return values
OutputResponseredirect()
Redirect response to $route
public
redirect(ControllerRoute $route) : RedirectHttpResponse|null
Parameters
- $route : ControllerRoute
Return values
RedirectHttpResponse|null —Should be overridden to be used
setRoute()
Set the route to this request
public
setRoute(ControllerRoute $route, array<string|int, mixed> $values) : InputRequest
Parameters
- $route : ControllerRoute
- $values : array<string|int, mixed>
Return values
InputRequestsetInput()
Set the input
protected
setInput(array<string|int, mixed>|string|null $input) : InputRequest
Parameters
- $input : array<string|int, mixed>|string|null
Return values
InputRequestsetParameters()
Set the parameters
protected
setParameters(array<string|int, mixed> $parameters) : InputRequest
Parameters
- $parameters : array<string|int, mixed>
Return values
InputRequestsetPath()
Set the path
protected
setPath(string $path) : InputRequest
Parameters
- $path : string