Adds a prefix to the path of all child routes.
@api
string $prefix An optional prefix to add before each pattern of the route collection:
array $defaults An array of default values:
array $requirements An array of requirements:
public function addPrefix($prefix, array $defaults = array(), array $requirements = array()) {
$prefix = trim(trim($prefix), '/');
if ('' === $prefix) {
return;
}
foreach ($this->routes as $route) {
$route
->setPath('/' . $prefix . $route
->getPath());
$route
->addDefaults($defaults);
$route
->addRequirements($requirements);
}
}