From 4d6a2f2681871c3238c7f44184329661d90dc4e4 Mon Sep 17 00:00:00 2001 From: Dave M Date: Wed, 12 Oct 2022 18:16:57 +0000 Subject: [PATCH] Added a new matchRouteName method --- src/Annotation/Method/Route.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Annotation/Method/Route.php b/src/Annotation/Method/Route.php index dcdf3ea..ec7b824 100644 --- a/src/Annotation/Method/Route.php +++ b/src/Annotation/Method/Route.php @@ -42,8 +42,13 @@ class Route implements \Notes\Annotation { public function getRoute() : string { return rtrim("/" . trim(isset($this->base) ? - "/" . trim($this->base, "/") . "/" . ltrim($this->route, "/") - : - "/" . ltrim($this->route, "/"), "/"), '/'); + "/" . trim($this->base, "/") . "/" . ltrim($this->route, "/") + : + "/" . ltrim($this->route, "/"), "/"), '/'); + } + + public function matchRouteName(string $name) : bool + { + return strtolower($this->name) === strtolower($name); } }