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; }