[FEATURE] Optimised route matching, added optional parameters.

- Optimised route matching. This should be way more officient and also
  seems to fix issues with getting the current route using the getRoute class.

- Added support for optional routes, for example: {id?}.

- Updated documentation to reflect new changes.
This commit is contained in:
Simon Sessingø
2015-11-21 19:31:06 +01:00
parent b930c06683
commit 3b4954821a
4 changed files with 94 additions and 93 deletions
+1 -1
View File
@@ -224,7 +224,7 @@ class RouterBase {
$i = 0;
foreach($params as $param => $value) {
$value = (isset($parameters[$param])) ? $parameters[$param] : $value;
$url = str_ireplace('{' . $param. '}', $value, $url);
$url = str_ireplace(array('{' . $param. '}', '{' . $param. '?}'), $value, $url);
$i++;
}
} else {