/** * Parses a route and adds it to the RouteCollection. * * @param MethodCollection $collection A RouteCollection instance * @param string $name Route name * @param array $config Route definition * @param string $path Full path of the YAML file being processed */ protected function parseRoute(MethodCollection $collection, $name, array $config, $path) { $context = array_key_exists('context', $config) ? (array) $config['context'] : []; $method = array_key_exists('method', $config) ? $config['method'] : $name; $inherit = array_key_exists('inherit', $config) ? $config['inherit'] : true; $route = new Route($method, $config['controller'], $context, array_key_exists('default_context', $config) ? $config['default_context'] : true, $inherit); $collection->add($name, $route); }
protected function addRoute(MethodCollection $collection, Method $annot, array $parents, \ReflectionClass $class, \ReflectionMethod $method) { $collection->add($annot->getMethod(), new Route($annot->getMethod(), $class->getName() . '::' . $method->getName(), array_merge($parents['context'], $annot->getContext()), $parents['default_context'] && $annot->isDefaultContext(), $annot->isInherit())); }