[ROUTES] Add easier support for using TemplateController and improved documentation

This commit is contained in:
Hugo Sales 2020-06-21 14:00:14 +00:00 committed by Hugo Sales
parent f28ff24f2a
commit 491e82f94e
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 5 additions and 4 deletions

View File

@ -68,10 +68,10 @@ class RouteLoader extends Loader
/**
* Connect a route to a controller
*
* @param string $id
* @param string $uri_path
* @param string $id Route unique id, used to generate urls, for instance
* @param string $uri_path Path, possibly with {param}s
* @param mixed $target Some kind of callable, typically [object, method]
* @param null|array $param_reqs
* @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']
* 'http-methods' and 'methods' are aliases
@ -89,7 +89,8 @@ class RouteLoader extends Loader
'_controller' => is_array($target) ? $target : [$target, '__invoke'],
'_format' => $options['format'] ?? 'html',
'_fragment' => $options['fragment'] ?? '',
'_locale' => $options['locale'] ?? '',
'_locale' => $options['locale'] ?? 'en',
'template' => $options['template'] ?? 'en',
],
$options['defaults'] ?? []),
// requirements = [] -- param => regex