public function parse(string $method, string $uri, string $prefix = ""): ParsedRoute
    {
        $uri = trim(explode("?", $uri)[0]);
        if ($prefix !== "" && substr($prefix, 0, 1) !== "/") {
            $prefix = "/".$prefix;
        }
        try {
            return $this->findMatches($method, $uri, $prefix);
        } catch (RouteNotFoundException $e) {
            $allowed_methods = [];
            foreach ($this->routes as $available_method => $routes) {
                try {
                    $this->findMatches($available_method, $uri, $prefix);
                    $allowed_methods[] = $available_method;
                } catch (RouteNotFoundException $e) {
                    // not found, skip
                }
            }
            if (count($allowed_methods)) {
                throw new MethodNotAllowedException(implode(", ", $allowed_methods));
            }

            throw new RouteNotFoundException("No route for '{$uri}' found");
        }
    }