Methods summary
public
boolean
|
#
Route( )
Returns
boolean
Throws
LogicException Route configuration property is missing.
InvalidArgumentException Wrong route pattern format.
Inheritdocs
|
public
boolean
|
#
RedefineRoutedTarget( string $controllerNamePc = NULL, string $actionNamePc = NULL, boolean $changeSelfRoute = FALSE )
Parameters
- $controllerNamePc
- Pascal case classic controller name definition.
- $actionNamePc
- Pascal case action name without
Action suffix.
- $changeSelfRoute
FALSE by default to change self route to generate self URLs.
Returns
boolean
Inheritdocs
|
public
MvcCore\Route
|
#
SetOrCreateDefaultRouteAsCurrent( string $routeName, string $controllerPc, string $actionPc, boolean $fallbackCall = FALSE )
Parameters
- $routeName
Always as default , error or not_found , by constants:
\MvcCore\IRouter::DEFAULT_ROUTE_NAME
\MvcCore\IRouter::DEFAULT_ROUTE_NAME_ERROR
\MvcCore\IRouter::DEFAULT_ROUTE_NAME_NOT_FOUND
- $controllerPc
- Controller name in pascal case.
- $actionPc
- Action name with pascal case without ending
Action substring.
- $fallbackCall
FALSE by default. If TRUE , this function is called from error rendering fallback, self route name is not changed.
Returns
Inheritdocs
|
protected
string[]
|
#
routeDetectStrategy( )
Detect and set up route strategy to complete requested controller and action.
Return strategy to complete those values by query string if:
- If there is controller and also action, both defined in query string.
- Or if requested path is / (or /index.php ) and there is defined
controller or action in query string.
Else then choose strategy to complete controller and action by rewrite routes.
Return array with possible query string controller name and action.
Detect and set up route strategy to complete requested controller and action.
Return strategy to complete those values by query string if:
- If there is controller and also action, both defined in query string.
- Or if requested path is / (or /index.php ) and there is defined controller or action in query string.
Else then choose strategy to complete controller and action by rewrite routes.
Return array with possible query string controller name and action.
Returns
string[]
|
protected
|
#
queryStringRouting( string|null $requestCtrlName, string|null $requestActionName )
If there is chosen query string routing strategy, create new route by
controller and action directly assigned from request and if controller or
action values are missing, assign there default controller and action values.
Set up also default and request params by request object.
If there is chosen query string routing strategy, create new route by
controller and action directly assigned from request and if controller or
action values are missing, assign there default controller and action values.
Set up also default and request params by request object.
Request params are necessary to complete any self URL, to route request
properly, to complete canonical URL and to process possible route redirection.
Default params are necessary to handle route filtering in and out and to
complete URL by any other route name for case, when some required param
is not presented in second $params argument in Url() method (then the
param is assigned from default params).
Parameters
- $requestCtrlName
Possible controller name value or NULL assigned directly
from request object in \MvcCore\router::routeDetectStrategy();
- $requestActionName
Possible action name value or NULL assigned directly
from request object in \MvcCore\router::routeDetectStrategy();
|
protected
boolean
|
#
routeProcessRouteRedirectionIfAny( )
After route matching process is done and there is completed current route
object, check if current route object contains redirect configuration.
If route contains redirection to another route, redirect request to target
URL, which is completed by standard Url() router method by target route
name and by given request params. Redirect with code 301 - Moved permanently.
If there was necessary to redirect, return FALSE , else return TRUE .
After route matching process is done and there is completed current route
object, check if current route object contains redirect configuration.
If route contains redirection to another route, redirect request to target
URL, which is completed by standard Url() router method by target route
name and by given request params. Redirect with code 301 - Moved permanently.
If there was necessary to redirect, return FALSE , else return TRUE .
Returns
boolean
|
protected
MvcCore\Router
|
#
routeSetUpDefaultForHomeIfNoMatch( )
After routing is done, check if there is any current route.
If there is no current route found by any strategy, there is possible to
create default route object into current object automatically newly created
by default configured values. It is necessary to check if request is
targeting homepage or if router is configured to route request to default
controller and action. If those two conditions are OK, create new route
with default controller and action and set this new route as current route
to process default controller and action even if there is no route for it.
After routing is done, check if there is any current route.
If there is no current route found by any strategy, there is possible to
create default route object into current object automatically newly created
by default configured values. It is necessary to check if request is
targeting homepage or if router is configured to route request to default
controller and action. If those two conditions are OK, create new route
with default controller and action and set this new route as current route
to process default controller and action even if there is no route for it.
Returns
|
protected
MvcCore\Router
|
#
routeSetUpSelfRouteNameIfAny( )
After routing is done, check if there is any current route and set up
property $this->selfRouteName about currently matched route name
to complete any time later self url.
After routing is done, check if there is any current route and set up
property $this->selfRouteName about currently matched route name
to complete any time later self url.
Returns
|