From 2b8b31289d2f4b27c1bc8355348e529cb2177ebc Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 6 Sep 2023 11:49:54 +0000 Subject: [PATCH] Added interface for route handlers. --- VERSION | 2 +- src/Http/HttpFx.php | 12 +++++++++++- src/Routing/IRouteHandler.php | 10 ++++++++++ src/Routing/IRouter.php | 9 ++++++++- src/Routing/Router.php | 11 ++++++++++- 5 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 src/Routing/IRouteHandler.php diff --git a/VERSION b/VERSION index df8466e..5a96943 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2308.220004 +0.2309.61148 diff --git a/src/Http/HttpFx.php b/src/Http/HttpFx.php index c6bf3da..ede90bd 100644 --- a/src/Http/HttpFx.php +++ b/src/Http/HttpFx.php @@ -1,7 +1,7 @@ router->add('options', $path, $handler); } + + /** + * Registers routes in an IRouteHandler implementation. + * + * @param IRouteHandler $handler Routes handler. + */ + public function register(IRouteHandler $handler): void { + $handler->registerRoutes($this->router); + } } diff --git a/src/Routing/IRouteHandler.php b/src/Routing/IRouteHandler.php new file mode 100644 index 0000000..3122c4d --- /dev/null +++ b/src/Routing/IRouteHandler.php @@ -0,0 +1,10 @@ +add('options', $path, $handler); } + + /** + * Registers routes in an IRouteHandler implementation. + * + * @param IRouteHandler $handler Routes handler. + */ + public function register(IRouteHandler $handler): void { + $handler->registerRoutes($this); + } }