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

This commit is contained in:
mcndave committed 2024-11-22 20:49:51 -05:00
1 parent a4d99dfe08
commit 63c7dc23f9
1 file changed
+1 -9
+1 -9
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