Trait Matching
Methods summary
public
array
&
|
#
Matches( MvcCore\IRequest $request, $localization = NULL )
Return array of matched params if incoming request match this route
or NULL if doesn't. Returned array must contain all matched reverse
params with matched controller and action names by route and by matched
params. Route is matched usually if request property path matches by
PHP preg_match_all() route match pattern. Sometimes, matching subject
could be different if route specifies it - if route pattern (or match )
property contains domain (or base path part) - it means if it is absolute
or if pattern (or match ) property contains a query string part.
This method is usually called in core request routing process
from \MvcCore\Router::Route(); method and it's sub-methods.
Return array of matched params if incoming request match this route
or NULL if doesn't. Returned array must contain all matched reverse
params with matched controller and action names by route and by matched
params. Route is matched usually if request property path matches by
PHP preg_match_all() route match pattern. Sometimes, matching subject
could be different if route specifies it - if route pattern (or match )
property contains domain (or base path part) - it means if it is absolute
or if pattern (or match ) property contains a query string part.
This method is usually called in core request routing process
from \MvcCore\Router::Route(); method and it's sub-methods.
Parameters
- $request
- The request object instance.
- $localization
Returns
array Matched and params array, keys are matched
params or controller and action params.
Throws
LogicException Route configuration property is missing.
InvalidArgumentException Wrong route pattern format.
|
protected
string
|
#
matchesGetPattern( string $localization = NULL )
Return localized pattern value used for preg_match_all() route match
processing. Check if non-localized property match has any value and
if it has, use it as result match. If there is not match property
defined, check if there is any localized match defined and if it is,
use it as result match. If there is any result match in those places,
process internal route initialization only on reverse (or pattern )
property (or on their localized equivalents), because match regular
expression is probably prepared and initialized manually. If there is no
value for result match (NULL ), process internal initialization on
pattern property (or on reverse if exists or on their localized
equivalents) and complete regular expression into result match and
metadata about reverse property (or localized reverse value) to
build URL address any time later on this route.
Return localized pattern value used for preg_match_all() route match
processing. Check if non-localized property match has any value and
if it has, use it as result match. If there is not match property
defined, check if there is any localized match defined and if it is,
use it as result match. If there is any result match in those places,
process internal route initialization only on reverse (or pattern )
property (or on their localized equivalents), because match regular
expression is probably prepared and initialized manually. If there is no
value for result match (NULL ), process internal initialization on
pattern property (or on reverse if exists or on their localized
equivalents) and complete regular expression into result match and
metadata about reverse property (or localized reverse value) to
build URL address any time later on this route.
Parameters
- $localization
Lower case language code, optionally with
dash and upper case locale code.
Returns
string
Throws
LogicException Route configuration property is missing.
InvalidArgumentException Wrong route pattern format.
|