|
|
@ -33,6 +33,7 @@ use Throwable;
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Routing
|
|
|
|
* Routing
|
|
|
|
* @method void route(string $pattern, callable $callback, bool $pass_route = false) Routes a URL to a callback function.
|
|
|
|
* @method void route(string $pattern, callable $callback, bool $pass_route = false) Routes a URL to a callback function.
|
|
|
|
|
|
|
|
* @method void group(string $pattern, callable $callback) Groups a set of routes together under a common prefix.
|
|
|
|
* @method void get(string $pattern, callable $callback, bool $pass_route = false) Routes a GET URL to a callback function.
|
|
|
|
* @method void get(string $pattern, callable $callback, bool $pass_route = false) Routes a GET URL to a callback function.
|
|
|
|
* @method void post(string $pattern, callable $callback, bool $pass_route = false) Routes a POST URL to a callback function.
|
|
|
|
* @method void post(string $pattern, callable $callback, bool $pass_route = false) Routes a POST URL to a callback function.
|
|
|
|
* @method void put(string $pattern, callable $callback, bool $pass_route = false) Routes a PUT URL to a callback function.
|
|
|
|
* @method void put(string $pattern, callable $callback, bool $pass_route = false) Routes a PUT URL to a callback function.
|
|
|
@ -151,7 +152,7 @@ class Engine
|
|
|
|
$methods = [
|
|
|
|
$methods = [
|
|
|
|
'start', 'stop', 'route', 'halt', 'error', 'notFound',
|
|
|
|
'start', 'stop', 'route', 'halt', 'error', 'notFound',
|
|
|
|
'render', 'redirect', 'etag', 'lastModified', 'json', 'jsonp',
|
|
|
|
'render', 'redirect', 'etag', 'lastModified', 'json', 'jsonp',
|
|
|
|
'post', 'put', 'patch', 'delete',
|
|
|
|
'post', 'put', 'patch', 'delete', 'group',
|
|
|
|
];
|
|
|
|
];
|
|
|
|
foreach ($methods as $name) {
|
|
|
|
foreach ($methods as $name) {
|
|
|
|
$this->dispatcher->set($name, [$this, '_' . $name]);
|
|
|
|
$this->dispatcher->set($name, [$this, '_' . $name]);
|
|
|
@ -472,6 +473,17 @@ class Engine
|
|
|
|
* Routes a URL to a callback function.
|
|
|
|
* Routes a URL to a callback function.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
|
|
|
|
* @param callable $callback Callback function that includes the Router class as first parameter
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function _group(string $pattern, callable $callback): void
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->router()->group($pattern, $callback);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Routes a URL to a callback function.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|