Merge pull request #7 from splashsky/improve-tokenizing-speed
⏱️ Replace preg_replace in tokenize with str_replace
This commit is contained in:
commit
c45aed8ec8
|
@ -131,12 +131,12 @@ class Router
|
||||||
$matches = $matches[1];
|
$matches = $matches[1];
|
||||||
|
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$pattern = "/(?:{".$match."})+/";
|
$pattern = '{'.$match.'}';
|
||||||
|
|
||||||
if (in_array($match, $constraints)) {
|
if (in_array($match, $constraints)) {
|
||||||
$uri = preg_replace($pattern, '('.self::$constraints[$match].')', $uri);
|
$uri = str_replace($pattern, '('.self::$constraints[$match].')', $uri);
|
||||||
} else {
|
} else {
|
||||||
$uri = preg_replace($pattern, self::$defaultConstraint, $uri);
|
$uri = str_replace($pattern, self::$defaultConstraint, $uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user