Skip to content

Commit a4c350e

Browse files
authored
Update Routes.php
1 parent acaeff3 commit a4c350e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Routes.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ public function __construct(
2020
) {
2121
}
2222

23+
public function __clone(): void
24+
{
25+
$groups = $this->groups;
26+
$routes = $this->routes;
27+
28+
$this->routes = [];
29+
$this->groups = [];
30+
31+
foreach ($routes as $k => $route) $this->routes[$k] = clone $route;
32+
foreach ($groups as $k => $group) $this->groups[$k] = $group::copy($this, $group);
33+
}
34+
2335
public function match(RouteMap $routes, string $uri, string $requestMethod):? RouteRecord
2436
{
2537
if ($routes instanceof Matcher && $routes !== $this) {

0 commit comments

Comments
 (0)