diff --git a/src/Route/Attribute/Method/Route.php b/src/Route/Attribute/Method/Route.php index 04c96a5..efa9073 100644 --- a/src/Route/Attribute/Method/Route.php +++ b/src/Route/Attribute/Method/Route.php @@ -25,6 +25,19 @@ class Route implements \Notes\Attribute { "/" . ltrim($this->route, "/"), "/"), '/'); } + public function getRegistrableRoute() : string + { + $splitRoute = explode('/', $this->getRoute()); + + foreach($splitRoute as &$route) { + if (strstr($route, '=')) { + $route = preg_replace('/(\=.*)(?=\})/i', '', $route); + } + } + + return implode('/', $splitRoute); + } + public function matchRouteName(string $name) : bool { return strtolower($this->name) === strtolower($name);