Adds a route.
@api
string $name The route name:
Route $route A Route instance:
\InvalidArgumentException When route name contains non valid characters
public function add($name, Route $route) {
if (!preg_match('/^[a-z0-9A-Z_.]+$/', $name)) {
throw new \InvalidArgumentException(sprintf('The provided route name "%s" contains non valid characters. A route name must only contain digits (0-9), letters (a-z and A-Z), underscores (_) and dots (.).', $name));
}
$this
->remove($name);
$this->routes[$name] = $route;
}