protected function AnnotationClassLoader::addRoute in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/routing/Loader/AnnotationClassLoader.php \Symfony\Component\Routing\Loader\AnnotationClassLoader::addRoute()
1 call to AnnotationClassLoader::addRoute()
- AnnotationClassLoader::load in vendor/
symfony/ routing/ Loader/ AnnotationClassLoader.php - Loads from annotations from a class.
File
- vendor/
symfony/ routing/ Loader/ AnnotationClassLoader.php, line 133
Class
- AnnotationClassLoader
- AnnotationClassLoader loads routing information from a PHP class and its methods.
Namespace
Symfony\Component\Routing\LoaderCode
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 (!isset($defaults[$param
->getName()]) && $param
->isDefaultValueAvailable()) {
$defaults[$param
->getName()] = $param
->getDefaultValue();
}
}
$requirements = array_replace($globals['requirements'], $annot
->getRequirements());
$options = array_replace($globals['options'], $annot
->getOptions());
$schemes = array_merge($globals['schemes'], $annot
->getSchemes());
$methods = array_merge($globals['methods'], $annot
->getMethods());
$host = $annot
->getHost();
if (null === $host) {
$host = $globals['host'];
}
$condition = $annot
->getCondition();
if (null === $condition) {
$condition = $globals['condition'];
}
$route = $this
->createRoute($globals['path'] . $annot
->getPath(), $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
$this
->configureRoute($route, $class, $method, $annot);
$collection
->add($name, $route);
}