protected parseRoute ( |
||
$collection |
protected function parseRoute(RouteCollection $collection, $name, $config, $file)
{
$defaults = isset($config['defaults']) ? $config['defaults'] : array();
$requirements = isset($config['requirements']) ? $config['requirements'] : array();
$options = isset($config['options']) ? $config['options'] : array();
if (!isset($config['pattern'])) {
throw new \InvalidArgumentException(sprintf('You must define a "pattern" for the "%s" route.', $name));
}
$route = new Route($config['pattern'], $defaults, $requirements, $options);
$collection->add($name, $route);
}
/** * Parses a route and adds it to the RouteCollection. * * @param RouteCollection $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(RouteCollection $collection, $name, array $config, $path) { if (!empty($this->defaults)) { $config['defaults'] = array_merge($config['defaults'], $this->defaults); } parent::parseRoute($collection, $name, $config, $path); }