Skip to content

Commit c1fa21e

Browse files
committed
refactor: restructure route handling in Dispatcher to map methods to routes
1 parent 989e0e2 commit c1fa21e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Dispatcher.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ public function __construct(
2222
private LoggerInterface $logger,
2323
DispatcherRoutesFactoryInterface $routesFactory,
2424
) {
25-
$this->routes = $routesFactory->create();
25+
$routes = [];
26+
27+
foreach ($routesFactory->create() as $route) {
28+
foreach ($route->getMethods() as $method) {
29+
$routes[$method] = $route;
30+
}
31+
}
32+
33+
$this->routes = $routes;
2634
}
2735

2836
/**

0 commit comments

Comments
 (0)