\d+)/stream` is `/chat/{id}/stream`. * * Read from the declarations, not listed again here, so a route added to a controller, or a * site's controller appended through `alpaca_bot/rest/controllers`, is in it without anything * else changing. It lists what a route declares, not what a subclass's capability() override * may make of it: a controller that resolves a Chat-row route some other way is listed as if * it did not. * * @param iterable $controllers * @return list */ public static function chatRoutes(iterable $controllers): array { $routes = []; foreach ($controllers as $controller) { foreach ($controller->routes() as $route) { if ($route['capability'] !== Controller::CHAT) { continue; } $key = Controller::routeKey($route['path']); foreach (explode(',', $route['methods']) as $method) { $method = strtoupper(trim($method)); if ($method === '' || isset($routes[$key . ' ' . $method])) { continue; } $routes[$key . ' ' . $method] = [ 'key' => $key, 'method' => $method, 'path' => (string) preg_replace('#\(\?P<([^>]+)>[^)]+\)#', '{$1}', $route['path']), ]; } } } return array_values($routes); } }