Route class
Framework\Routing\Route
Class Route.
Implements:
JsonSerializable
Defined in libraries/routing/src/Route.php
Properties #
$router
$origin
$path
$action
$actionArguments
$name
$options
Methods #
- __construct()
- Route constructor.
- getAction()
- Gets the Route action.
- getActionArguments()
- Gets the Route action arguments.
- getName()
- Gets the Route name.
- getOptions()
- Gets Route options.
- getOrigin()
- Gets the Route URL origin.
- getPath()
- Gets the Route URL path.
- getUrl()
- Gets the Route URL.
- jsonSerialize()
- -
- run()
- Runs the Route action.
- setAction()
- Sets the Route action.
- setActionArguments()
- Sets the Route action arguments.
- setName()
- Sets the Route name.
- setOptions()
- Sets options to be used in a specific environment application. For example: its possible set Access Control List options, Locations, Middleware filters, etc.
- setPath()
- Sets the Route URL path.
- extractMethodAndArguments()
- -
- makeResponse()
- Make the final Response used in the 'run' method.
- makeResponseBodyPart()
- Make a string to be appended in the Response body based in the route action result.
- onNamedRoutePart()
- -
- setOrigin()
- -
- toArrayOfStrings()
- -
__construct()
Route constructor.
- \Framework\Routing\Router $router - A Router instance
- string $origin - URL Origin. A string in the following format: {scheme}://{hostname}[:{port}]
- string $path - URL Path. A string starting with '/'
- Closure|string $action - The action
getAction()
Gets the Route action.
getActionArguments()
Gets the Route action arguments.
getName()
Gets the Route name.
getOptions()
Gets Route options.
getOrigin()
Gets the Route URL origin.
- string $arguments
getPath()
Gets the Route URL path.
- string $arguments
getUrl()
Gets the Route URL.
Note: Arguments must be passed if placeholders need to be filled.
- array $originArgs - Arguments to fill the URL Origin placeholders
- array $pathArgs - Arguments to fill the URL Path placeholders
jsonSerialize()
run()
Runs the Route action.
- mixed $construct
setAction()
Sets the Route action.
- Closure|string $action - A Closure or a string in the format of the `__METHOD__` constant. Example: `App\Blog::show`. The action can be suffixed with ordered parameters, separated by slashes, to set how the arguments will be passed to the class method. Example: `App\Blog::show/0/2/1`. And, also with the asterisk wildcard, to pass all arguments in the incoming order. Example: `App\Blog::show/*`
setActionArguments()
Sets the Route action arguments.
- array $arguments - The arguments. Note that the indexes set the order of how the arguments are passed to the Action
setName()
Sets the Route name.
- string $name
setOptions()
Sets options to be used in a specific environment application. For example: its possible set Access Control List options, Locations, Middleware filters, etc.
- array $options
setPath()
Sets the Route URL path.
- string $path
extractMethodAndArguments()
- string $part - An action part like: index/0/2/1
makeResponse()
Make the final Response used in the 'run' method.
- mixed $result
makeResponseBodyPart()
Make a string to be appended in the Response body based in the route action result.
- mixed $result - The return value of the matched route action
onNamedRoutePart()
setOrigin()
- string $origin
toArrayOfStrings()
- array $array