[OPTIMISATION] Parameters matching optimisations.

This commit is contained in:
Simon Sessingø
2016-01-15 10:20:50 +01:00
parent b096742d6b
commit 714edf7902
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -238,7 +238,7 @@ abstract class RouterEntry {
return new $name();
}
protected function parseParameters($route, $url, $parameterRegex = '[a-z0-9]*?') {
protected function parseParameters($route, $url, $parameterRegex = '[a-z0-9]+?') {
$parameterNames = array();
$regex = '';
$lastCharacter = '';
@@ -274,7 +274,7 @@ abstract class RouterEntry {
if($lastCharacter === '?') {
$parameter = substr($parameter, 0, strlen($parameter)-1);
$regex .= '(?:\\/?(?P<'.$parameter.'>[^\/]*)?\\/?)';
$regex .= '(?:\\/?(?P<'.$parameter.'>[^\/]+)?\\/?)';
$required = false;
} else {
$regex .= '\\/(?P<' . $parameter . '>'. $parameterRegex .')\\/';