[FEATURE] Option to disable multi-route rendering

- Added option to disable multi-route rendering by calling `Router::setRenderMultipleRoutes($bool)`.
- Added alias for easier access `SimpleRouter::enableMultiRouteRendering($bool)`.
- Added php-unit tests for multi-routing enabled and disabled.
This commit is contained in:
Simon Sessingø
2021-03-22 19:34:55 +01:00
parent f74252e8cc
commit 1d2e5f47d9
3 changed files with 88 additions and 9 deletions
+12
View File
@@ -532,6 +532,18 @@ class SimpleRouter
return $route;
}
/**
* Changes the rendering behavior of the router.
* When enabled the router will render all routes that matches.
* When disabled the router will stop rendering at the first route that matches.
*
* @param bool $bool
*/
public static function enableMultiRouteRendering(bool $bool): void
{
static::router()->setRenderMultipleRoutes($bool);
}
/**
* Enable or disable dependency injection
*