[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 c9b0e994c1
commit 377965d100

View File

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