Public Member Functions | |
__construct ($route) | |
setMap (array $map) | |
getMap () | |
setReverse ($reverse) | |
getReverse () | |
match (HttpRequest $request) | |
Matches a user submitted path with parts defined by a map. | |
assembly (array $data=array(), $reset=false, $encode=false) | |
Static Public Member Functions | |
static | create ($route) |
Protected Member Functions | |
arrayMergeNumericKeys (array $array1, array $array2) | |
getMappedValues ($values, $reversed=false, $preserve=false) | |
Maps numerically indexed array values to it's associative mapped counterpart. | |
Protected Attributes | |
$regexp = null | |
$reverse = null | |
$route = null | |
$map = array() | |
$values = array() |
Definition at line 12 of file RouterRegexpRule.class.php.
RouterRegexpRule::__construct | ( | $ | route | ) |
Definition at line 29 of file RouterRegexpRule.class.php.
References $route.
RouterRegexpRule::arrayMergeNumericKeys | ( | array $ | array1, | |
array $ | array2 | |||
) | [protected] |
RouterRegexpRule::assembly | ( | array $ | data = array() , |
|
$ | reset = false , |
|||
$ | encode = false | |||
) |
Implements RouterRule.
Definition at line 97 of file RouterRegexpRule.class.php.
References arrayMergeNumericKeys(), and getMappedValues().
static RouterRegexpRule::create | ( | $ | route | ) | [static] |
Definition at line 24 of file RouterRegexpRule.class.php.
References $route.
RouterRegexpRule::getMap | ( | ) |
Definition at line 45 of file RouterRegexpRule.class.php.
RouterRegexpRule::getMappedValues | ( | $ | values, | |
$ | reversed = false , |
|||
$ | preserve = false | |||
) | [protected] |
Maps numerically indexed array values to it's associative mapped counterpart.
Or vice versa. Uses user provided map array which consists of index => name parameter mapping. If map is not found, it returns original array.
Method strips destination type of keys form source array. Ie. if source array is indexed numerically then every associative key will be stripped. Vice versa if reversed is set to true.
Definition at line 163 of file RouterRegexpRule.class.php.
References $values.
Referenced by assembly(), and match().
RouterRegexpRule::getReverse | ( | ) |
Definition at line 62 of file RouterRegexpRule.class.php.
RouterRegexpRule::match | ( | HttpRequest $ | request | ) |
Matches a user submitted path with parts defined by a map.
Assigns and returns an array of variables on a successful match.
TODO: array_filter_key()? Why isn't this in a standard PHP function set yet? :)
Implements RouterRule.
Definition at line 67 of file RouterRegexpRule.class.php.
References RouterBaseRule::$defaults, $values, getMappedValues(), and RouterBaseRule::processPath().
RouterRegexpRule::setMap | ( | array $ | map | ) |
Definition at line 38 of file RouterRegexpRule.class.php.
RouterRegexpRule::setReverse | ( | $ | reverse | ) |
Definition at line 53 of file RouterRegexpRule.class.php.
References $reverse, and Assert::isString().
RouterRegexpRule::$map = array() [protected] |
Definition at line 18 of file RouterRegexpRule.class.php.
RouterRegexpRule::$regexp = null [protected] |
Definition at line 14 of file RouterRegexpRule.class.php.
RouterRegexpRule::$reverse = null [protected] |
Definition at line 15 of file RouterRegexpRule.class.php.
Referenced by setReverse().
RouterRegexpRule::$route = null [protected] |
Definition at line 16 of file RouterRegexpRule.class.php.
Referenced by __construct(), and create().
RouterRegexpRule::$values = array() [protected] |
Definition at line 19 of file RouterRegexpRule.class.php.
Referenced by getMappedValues(), and match().