protected function addRoute(RouteCollection $collection, $annot, $globals, \ReflectionClass $class, \ReflectionMethod $method) {
$name = $annot
->getName();
if (null === $name) {
$name = $this
->getDefaultRouteName($class, $method);
}
$defaults = array_replace($globals['defaults'], $annot
->getDefaults());
foreach ($method
->getParameters() as $param) {
if ($param
->isOptional()) {
$defaults[$param
->getName()] = $param
->getDefaultValue();
}
}
$requirements = array_replace($globals['requirements'], $annot
->getRequirements());
$options = array_replace($globals['options'], $annot
->getOptions());
$schemes = array_replace($globals['schemes'], $annot
->getSchemes());
$methods = array_replace($globals['methods'], $annot
->getMethods());
$host = $annot
->getHost();
if (null === $host) {
$host = $globals['host'];
}
$route = new Route($globals['path'] . $annot
->getPath(), $defaults, $requirements, $options, $host, $schemes, $methods);
$this
->configureRoute($route, $class, $method, $annot);
$collection
->add($name, $route);
}