Methods summary
public
MvcCore\Router
|
#
SetRoutes( MvcCore\Route[] |array $routes = [], string|null $groupName = NULL, boolean $autoInitialize = TRUE )
Parameters
- $routes
Keyed array with routes, keys are route names or route
Controller::Action definitions.
- $groupName
Group name is first matched/parsed word in requested path to
group routes by to try to match only routes you really need,
not all of them. If NULL by default, routes are inserted
into default group.
- $autoInitialize
If TRUE , locale routes array is cleaned and then all
routes (or configuration arrays) are sent into method
$router->AddRoutes(); , where are routes auto initialized
for missing route names or route controller or route action
record, completed always from array keys. You can you FALSE
to set routes without any change or auto-initialization, it
could be useful to restore cached routes etc.
Returns
Inheritdocs
|
public
MvcCore\Router
|
#
AddRoutes( array $routes = [], string|null $groupName = NULL, boolean $prepend = FALSE, boolean $throwExceptionForDuplication = TRUE )
Parameters
- $routes
Keyed array with routes, keys are route names or route
Controller::Action definitions.
- $groupName
Group name is first matched/parsed word in requested path to
group routes by to try to match only routes you really need,
not all of them. If NULL by default, routes are inserted
into default group.
- $prepend
Optional, if TRUE , all given routes will be prepended from
the last to the first in given list, not appended.
- $throwExceptionForDuplication
TRUE by default. Throw an exception, if route name or
route Controller:Action has been defined already. If
FALSE old route is over-written by new one.
Returns
Inheritdocs
|
public
MvcCore\Router
|
#
AddRoute( MvcCore\Route |array $routeCfgOrRoute, string|null $groupName = NULL, boolean $prepend = FALSE, boolean $throwExceptionForDuplication = TRUE )
Parameters
- $routeCfgOrRoute
- Route instance or route config array.
- $groupName
Group name is first matched/parsed word in requested path to
group routes by to try to match only routes you really need,
not all of them. If NULL by default, routes are inserted
into default group.
- $prepend
Optional, if TRUE , given route will be prepended,
not appended.
- $throwExceptionForDuplication
TRUE by default. Throw an exception, if route name or
route Controller:Action has been defined already. If
FALSE old route is over-written by new one.
Returns
Inheritdocs
|
protected
|
#
addRouteToGroup( MvcCore\IRoute $route, string $routeName, string|null $groupName, boolean $prepend )
Add route instance into named routes group. Every routes group is chosen
in routing moment by first parsed word from requested URL.
Add route instance into named routes group. Every routes group is chosen
in routing moment by first parsed word from requested URL.
Parameters
- $route
- A route instance reference.
- $routeName
- Route name.
- $groupName
- Group name, first parsed word from requested URL.
- $prepend
- IF
TRUE , prepend route instance, FALSE otherwise.
|
public
boolean
|
|
public
MvcCore\Route |null
|
#
RemoveRoute( string $routeName )
Parameters
Returns
Inheritdocs
|
protected
|
#
removeRouteFromGroup( MvcCore\IRoute $route, string $routeName )
Unset route from defined group. This method doesn't unset the route
from router object to not be possible to create URL by given route anymore.
This does route method: \MvcCore\Route::RemoveRoute($routeName); .
Unset route from defined group. This method doesn't unset the route
from router object to not be possible to create URL by given route anymore.
This does route method: \MvcCore\Route::RemoveRoute($routeName); .
Parameters
|
public
MvcCore\Route[]
|
#
GetRoutes( string|null $groupName = NULL )
Parameters
- $groupName
Group name is first matched/parsed word in requested path to
group routes by to try to match only routes you really need,
not all of them. If NULL by default, there are returned
all routes from all groups.
Returns
Inheritdocs
|
public
MvcCore\Route |null
|
|
public
MvcCore\Router
|
|
public
MvcCore\Route
|
|
protected
MvcCore\Route
|
#
getRouteInstance( MvcCore\Route |array & $routeCfgOrRoute )
Get always route instance from given route configuration data or return
already created given instance.
Get always route instance from given route configuration data or return
already created given instance.
Parameters
- $routeCfgOrRoute
- Route instance or route config array.
Returns
|