- Route now supports default values

This commit is contained in:
Dave M. 2024-11-22 20:46:23 -05:00
parent f199cc7085
commit a4d99dfe08
1 changed files with 13 additions and 0 deletions

View File

@ -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);