Router
in package
Router class.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Router class.
- dispatch() : array<string|int, mixed>
- Setup and then dispatch the route.
- filterMethod() : mixed
- getControllerMethodName() : array<string|int, mixed>
- Get full controller class name and full method name from string or handler.
- filterMethod() : mixed
- Filter method to replace `any` method to all available methods and upper case for method array.
- setupRoute() : Dispatcher
- Setup the routes and create dispatcher.
Properties
$Container
protected
Container
$Container
Methods
__construct()
Router class.
public
__construct(Container $Container) : mixed
Parameters
- $Container : Container
-
The DI container class.
dispatch()
Setup and then dispatch the route.
public
dispatch() : array<string|int, mixed>
Return values
array<string|int, mixed>filterMethod()
public
filterMethod([mixed $method = ]) : mixed
Filter method to replace any
method to all available methods and upper case for method array.
Parameters
- $method : mixed =
getControllerMethodName()
Get full controller class name and full method name from string or handler.
public
getControllerMethodName(string $controllerMethod) : array<string|int, mixed>
Parameters
- $controllerMethod : string
-
The handle or controller, class string. Example:
'Contact:index'
will be'ContactController'
and'indexAction'
.
Return values
array<string|int, mixed> —Return 2D array where the first array is the controller class name and second array is method name.
If the $controllerMethod
is not valid Controller:method then it will be return only first array value and second array is empty.
filterMethod()
Filter method to replace `any` method to all available methods and upper case for method array.
protected
filterMethod(mixed $method) : mixed
Parameters
- $method : mixed
setupRoute()
Setup the routes and create dispatcher.
protected
setupRoute() : Dispatcher