[ROUTER] Add option is_system_path, to allow specifying that a route, such as gsactor_view_nickname should not be considered a system path, when checking for the collision of nicknames

This commit is contained in:
2021-09-15 16:36:14 +01:00
committed by Diogo Peralta Cordeiro
parent e563c393f8
commit 15a2a69274
3 changed files with 11 additions and 10 deletions

View File

@@ -96,7 +96,7 @@ class RouteLoader extends Loader
* @param mixed $target Some kind of callable, typically class with `__invoke` or [object, method]
* @param null|array $param_reqs Array of {param} => regex
* @param null|array $options Possible keys are ['condition', 'defaults', 'format',
* 'fragment', 'http-methods', 'locale', 'methods', 'schemes', 'accept']
* 'fragment', 'http-methods', 'locale', 'methods', 'schemes', 'accept', 'is_system_path']
* 'http-methods' and 'methods' are aliases
*/
public function connect(string $id, string $uri_path, $target, ?array $options = [], ?array $param_reqs = [])
@@ -109,12 +109,13 @@ class RouteLoader extends Loader
// and special configuration options
defaults: array_merge(
[
'_controller' => is_array($target) ? $target : [$target, '__invoke'],
'_format' => $options['format'] ?? 'html',
'_fragment' => $options['fragment'] ?? '',
'_locale' => $options['locale'] ?? 'en',
'template' => $options['template'] ?? '',
'accept' => $options['accept'] ?? [],
'_controller' => is_array($target) ? $target : [$target, '__invoke'],
'_format' => $options['format'] ?? 'html',
'_fragment' => $options['fragment'] ?? '',
'_locale' => $options['locale'] ?? 'en',
'template' => $options['template'] ?? '',
'accept' => $options['accept'] ?? [],
'is_system_path' => $options['is_system_path'] ?? true,
],
$options['defaults'] ?? []
),