Added a new matchRouteName method

This commit is contained in:
Dave M. 2022-10-12 18:16:57 +00:00
parent 6fcfd20aed
commit 4d6a2f2681
1 changed files with 8 additions and 3 deletions

View File

@ -42,8 +42,13 @@ class Route implements \Notes\Annotation {
public function getRoute() : string public function getRoute() : string
{ {
return rtrim("/" . trim(isset($this->base) ? return rtrim("/" . trim(isset($this->base) ?
"/" . trim($this->base, "/") . "/" . ltrim($this->route, "/") "/" . trim($this->base, "/") . "/" . ltrim($this->route, "/")
: :
"/" . ltrim($this->route, "/"), "/"), '/'); "/" . ltrim($this->route, "/"), "/"), '/');
}
public function matchRouteName(string $name) : bool
{
return strtolower($this->name) === strtolower($name);
} }
} }