private function generateMatchMethod(): string
    {
        // Group hosts by same-suffix, re-order when possible
        $routes = new StaticPrefixCollection();
        foreach ($this->getRoutes()->all() as $name => $route) {
            $routes->addRoute('/(.*)', [$name, $route]);
        }

        $routes = $this->getRoutes();

        $code = rtrim($this->compileRoutes($routes), "\n");

        $code = <<<EOF
    {
$code

EOF;

        return "    public function match(string \$channel): array\n".$code."\n        throw new ResourceNotFoundException();\n    }";
    }