- Reworked url default value removal; preg_replace will remove them without having to slit the string

This commit is contained in:
Dave M. 2024-11-22 20:49:51 -05:00
parent a4d99dfe08
commit 63c7dc23f9
1 changed files with 1 additions and 9 deletions

View File

@ -27,15 +27,7 @@ class Route implements \Notes\Attribute {
public function getRegistrableRoute() : string public function getRegistrableRoute() : string
{ {
$splitRoute = explode('/', $this->getRoute()); return preg_replace('/(\=.*)(?=\})/i', '', $this->getRoute());
foreach($splitRoute as &$route) {
if (strstr($route, '=')) {
$route = preg_replace('/(\=.*)(?=\})/i', '', $route);
}
}
return implode('/', $splitRoute);
} }
public function matchRouteName(string $name) : bool public function matchRouteName(string $name) : bool