Simplify router code.

This commit is contained in:
Taylor Otwell 2011-07-18 06:17:21 -07:00
parent 72658bd09a
commit dc49a4aaeb
1 changed files with 1 additions and 1 deletions

View File

@ -92,7 +92,7 @@ private static function translate_wildcards($key)
// Now, to properly close the regular expression, we need to append a ")?" for each optional segment in the route.
if ($replacements > 0)
{
$key .= implode('', array_fill(0, $replacements, ')?'));
$key .= str_repeat(')?', $replacements);
}
return str_replace(array(':num', ':any'), array('[0-9]+', '[a-zA-Z0-9\-_]+'), $key);