diff --git a/src/Service/Router.php b/src/Service/Router.php index 3dca0bf..6518c74 100644 --- a/src/Service/Router.php +++ b/src/Service/Router.php @@ -107,18 +107,18 @@ class Router if ($route->getName() == $routeName) { if ($vars) { // build route for dynamic routes - $newRoute = $route->getRoute(); + $route = $route->getRoute(); // replace placeholder with current values foreach ($vars as $key => $value) { - $newRoute = str_replace(search: '{' . $key . '}', replace: $value, subject: $route); + $route = str_replace(search: '{' . $key . '}', replace: $value, subject: $route); } - return $newRoute; + return $route; } else { return $route->getRoute(); } } } - // no 404, this is reached only if the code is wrong + // no 404, this is reached only if the code is buggy die("Missing Route: $routeName"); } } \ No newline at end of file