public function connectRoute(Route $route) { $this->routes[] = $route; $key = $route->getKey(); if (!is_null($key)) { if (isset($this->indexed[$key])) { throw new RouteException("Route '{$key}' already exists"); } $this->indexed[$key] = $route; } return $this; }