mirror of
https://github.com/dannyvankooten/AltoRouter.git
synced 2025-08-06 08:27:39 +02:00
multi optional
This commit is contained in:
@@ -254,14 +254,18 @@ class AltoRouter {
|
||||
$pre = '\.';
|
||||
}
|
||||
|
||||
$optional = $optional !== '' ? '?' : null;
|
||||
|
||||
//Older versions of PCRE require the 'P' in (?P<named>)
|
||||
$pattern = '(?:'
|
||||
. ($pre !== '' ? $pre : null)
|
||||
. '('
|
||||
. ($param !== '' ? "?P<$param>" : null)
|
||||
. $type
|
||||
. '))'
|
||||
. ($optional !== '' ? '?' : null);
|
||||
. ')'
|
||||
. $optional
|
||||
. ')'
|
||||
. $optional;
|
||||
|
||||
$route = str_replace($block, $pattern, $route);
|
||||
}
|
||||
|
Reference in New Issue
Block a user