Methods summary
public
MvcCore\Route
|
|
public
string[]
|
#
__sleep( )
Returns
string[]
Inheritdocs
|
public
|
|
protected
|
#
initMatchAndReverse( )
Initialize properties match , reverse and other internal properties
about those values, when there is necessary to prepare pattern value
for: a) PHP preg_match_all() route match processing, b) for reverse
value for later self URL building. This method is usually called in core
request routing process from \MvcCore\Router::Matches(); method on each
route.
Initialize properties match , reverse and other internal properties
about those values, when there is necessary to prepare pattern value
for: a) PHP preg_match_all() route match processing, b) for reverse
value for later self URL building. This method is usually called in core
request routing process from \MvcCore\Router::Matches(); method on each
route.
Throws
LogicException Route configuration property is missing.
InvalidArgumentException Wrong route pattern format.
|
protected
stdClass[][]
|
#
initSectionsInfoForMatchAndReverse( string & $match, string & $reverse )
Process together given match and reverse value and complete two
arrays with sections info about those two given values. Also change the
given match and reverse string references and remove all brackets
[] defining variable section(s). Every result array with this sections
info, with those statistics contains for each fixed section or variable
section defined with brackets [] info about it's type (fixed or
variable), about start position, end position and length. Those
statistics are always used to build URL later.
Process together given match and reverse value and complete two
arrays with sections info about those two given values. Also change the
given match and reverse string references and remove all brackets
[] defining variable section(s). Every result array with this sections
info, with those statistics contains for each fixed section or variable
section defined with brackets [] info about it's type (fixed or
variable), about start position, end position and length. Those
statistics are always used to build URL later.
Parameters
- $match
- A match string prepared from
pattern property.
- $reverse
A reverse string value, directly from reverse
property or from pattern property if reverse
property is empty.
Returns
stdClass[][] Two arrays with array with \stdClass objects.
|
protected
|
#
initReverse( )
Initialize property reverse and other internal properties about this
value, when there is necessary to prepare it for: a) URL building, b) for
request routing, when there is configured match property directly
an when is necessary to initialize route flags from reverse to complete
correctly subject to match.
Initialize property reverse and other internal properties about this
value, when there is necessary to prepare it for: a) URL building, b) for
request routing, when there is configured match property directly
an when is necessary to initialize route flags from reverse to complete
correctly subject to match.
Throws
LogicException Route configuration property is missing.
InvalidArgumentException Wrong route pattern format.
|
protected
stdClass[][]
&
|
#
initSectionsInfo( string & $pattern )
Process given reverse value and complete array with sections info about
this given value. Also change the given reverse string reference and
remove all brackets [] defining variable section(s). The result array
with sections info, with this statistic contains for each fixed section
or variable section defined with brackets [] info about it's type
(fixed or variable), about start position, end position and length. This
statistic is always used to build URL later.
Process given reverse value and complete array with sections info about
this given value. Also change the given reverse string reference and
remove all brackets [] defining variable section(s). The result array
with sections info, with this statistic contains for each fixed section
or variable section defined with brackets [] info about it's type
(fixed or variable), about start position, end position and length. This
statistic is always used to build URL later.
Parameters
- $pattern
A reverse string value, directly from reverse
property or from pattern property if reverse
property is empty.
Returns
stdClass[][] An array with \stdClass objects.
|
protected
array
&
|
#
initReverseParams( string & $reverse, stdClass[] & $reverseSectionsInfo, array & $constraints, string|null & $match = NULL )
Initialize reverse params info array. Each item in completed array is
\stdClass object with records about founded parameter place: name ,
greedy , sectionIndex , reverseStart , reverseEnd . Records
matchStart and matchEnd could be values -1 when function argument
$match is NULL , because this function is used to complete match and
reverse properties together and also to complete reverse property
separately and only. Result array is always used as reverseParams
property to complete URL rewrite params inside result reverse string.
Initialize reverse params info array. Each item in completed array is
\stdClass object with records about founded parameter place: name ,
greedy , sectionIndex , reverseStart , reverseEnd . Records
matchStart and matchEnd could be values -1 when function argument
$match is NULL , because this function is used to complete match and
reverse properties together and also to complete reverse property
separately and only. Result array is always used as reverseParams
property to complete URL rewrite params inside result reverse string.
Parameters
- $reverse
- A reverse string with
<param> s.
- $reverseSectionsInfo
Reverse sections statistics with
fixed and variable sections.
- $constraints
- Route constraints array.
- $match
- A match string, could be
NULL .
Returns
array An array with keys as param names and values as
\stdClass objects with data about each reverse param.
Throws
InvalidArgumentException Wrong route pattern format.
|
protected
bool[]
|
#
initReverseParamsGetGreedyInfo( stdClass[] & $reverseSectionsInfo, array & $constraints, string & $paramName, integer & $sectionIndex, boolean & $greedyCaught )
Get if founded param place is greedy or not. If it's greedy, check if it
is only one greedy param in whole pattern string and if it is the last
param between other params. Get also if given section index belongs to
the last section info in line.
Get if founded param place is greedy or not. If it's greedy, check if it
is only one greedy param in whole pattern string and if it is the last
param between other params. Get also if given section index belongs to
the last section info in line.
Parameters
- $reverseSectionsInfo
Whole sections info array ref.
with \stdClass objects.
- $constraints
- Route params constraints.
- $paramName
- Route parsed params.
- $sectionIndex
- Currently checked section index.
- $greedyCaught
- Boolean about if param is checked as greedy.
Returns
bool[] Array with two boolean values. First is greedy flag
and second is about if section is last or not. The
second could be NULL
Throws
InvalidArgumentException Wrong route pattern format.
|
protected
|
#
initFlagsByPatternOrReverse( string $pattern )
Initialize three route integer flags. About if and what scheme definition
is contained in given pattern, if and what domain parts are contained in
given pattern and if given pattern contains any part of query string.
Given pattern is reverse and if reverse is empty, it's pattern prop.
Initialize three route integer flags. About if and what scheme definition
is contained in given pattern, if and what domain parts are contained in
given pattern and if given pattern contains any part of query string.
Given pattern is reverse and if reverse is empty, it's pattern prop.
Parameters
|
protected
string
|
#
initMatchComposeRegex( string & $match, stdClass[] & $matchSectionsInfo, array & $reverseParams, array & $constraints )
Compose regular expression pattern to match incoming request or not.
This method is called in route matching process, when it's necessary to
complete route match property from pattern property. The result
regular expression is always composed to match trailing slash or missing
trailing slash and any fixed and variable sections defined by pattern .
Compose regular expression pattern to match incoming request or not.
This method is called in route matching process, when it's necessary to
complete route match property from pattern property. The result
regular expression is always composed to match trailing slash or missing
trailing slash and any fixed and variable sections defined by pattern .
Parameters
- $match
A pattern string with escaped all special regular
expression special characters except <> chars.
- $matchSectionsInfo
Match sections info about fixed or variable
section, param name, start, end and length.
- $reverseParams
An array with keys as param names and values as
\stdClass objects with data about reverse params.
- $constraints
Route params regular expression constraints
Defining which value each param could contain or not.
If there is no constraint for param, there is used
default constraint defined in route static property.
Returns
string
|
protected
|
#
throwExceptionIfKeyPropertyIsMissing( string[] $propsNames )
Thrown a logic exception about missing key property in route object to
parse pattern or reverse . Those properties are necessary to complete
correctly match property to route incoming request or to complete
correctly reverse property to build URL address.
Thrown a logic exception about missing key property in route object to
parse pattern or reverse . Those properties are necessary to complete
correctly match property to route incoming request or to complete
correctly reverse property to build URL address.
Parameters
- $propsNames
- Missing properties names.
Throws
LogicException Route configuration property is missing.
|
public
string
|
#
__toString( )
This method serve only for debug and development purposes. It renders all
instance properties values into string, to print whole route in logic
exception message about what property is missing.
This method serve only for debug and development purposes. It renders all
instance properties values into string, to print whole route in logic
exception message about what property is missing.
Returns
string
|
private static
string[]
|
#
__getPropsNames( )
Return property names to be serialized.
Return property names to be serialized.
Returns
string[]
|