From 2345c5453fdcb334242406d8fb788001f0c3cab9 Mon Sep 17 00:00:00 2001 From: Dave M Date: Thu, 9 May 2024 19:52:10 +0000 Subject: [PATCH 1/2] - Added MatchRoute Method --- src/Route/Attribute/Method/Route.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Route/Attribute/Method/Route.php b/src/Route/Attribute/Method/Route.php index e741451..2efa7b1 100644 --- a/src/Route/Attribute/Method/Route.php +++ b/src/Route/Attribute/Method/Route.php @@ -2,6 +2,8 @@ namespace Notes\Route\Attribute\Method; +use Psr\Http\Message\ServerRequestInterface; + #[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_METHOD)] class Route implements \Notes\Attribute { public function __construct( @@ -27,6 +29,18 @@ class Route implements \Notes\Attribute { return strtolower($this->name) === strtolower($name); } + + public function match(mixed $name) : bool + { + foreach((array) $name as $item) { + if ( fnmatch($item, $this->name) ) { + return true; + } + } + + return false; + } + public function isRoute(string $name) { return $this->name === $name; } From 15992843347bef7d37d1da39831584d38bc4375e Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Tue, 21 May 2024 13:03:18 +0000 Subject: [PATCH 2/2] - Added route description --- src/Route/Attribute/Method/Route.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Route/Attribute/Method/Route.php b/src/Route/Attribute/Method/Route.php index 2efa7b1..04c96a5 100644 --- a/src/Route/Attribute/Method/Route.php +++ b/src/Route/Attribute/Method/Route.php @@ -14,6 +14,7 @@ class Route implements \Notes\Attribute { public ? string $class = null, public ? string $classMethod = null, public bool $currentRoute = false, + public string $description = "", ) {} public function getRoute() : string