/**
* @param Route $route
* @return self
*/
public function addRoute(Route $route)
{
$name = $route->getName();
if (isset($this->routes[$name])) {
throw new DomainException(sprintf('Failed adding route by name %s; a route by that name has already been registered', $name));
}
$this->routes[$name] = $route;
ksort($this->routes, defined('SORT_NATURAL') ? constant('SORT_NATURAL') : SORT_STRING);
return $this;
}