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