add('GET', $path, $handler); } public function post(string $path, callable|array|string $handler): Route { return $this->add('POST', $path, $handler); } public function add(string $method, string $path, callable|array|string $handler): Route { $route = new Route($method, $path, $handler); $this->routes[] = $route; return $route; } public function match(string $method, string $path): ?Route { foreach ($this->routes as $route) { if ($route->matches($method, $path)) { return $route; } } return null; } }