Parses an import and adds the routes in the resource to the RouteCollection.
RouteCollection $collection A RouteCollection instance:
array $config Route definition:
string $path Full path of the YAML file being processed:
string $file Loaded file name:
protected function parseImport(RouteCollection $collection, array $config, $path, $file) {
$type = isset($config['type']) ? $config['type'] : null;
$prefix = isset($config['prefix']) ? $config['prefix'] : '';
$defaults = isset($config['defaults']) ? $config['defaults'] : array();
$requirements = isset($config['requirements']) ? $config['requirements'] : array();
$options = isset($config['options']) ? $config['options'] : array();
$host = isset($config['host']) ? $config['host'] : null;
$schemes = isset($config['schemes']) ? $config['schemes'] : null;
$methods = isset($config['methods']) ? $config['methods'] : null;
$this
->setCurrentDir(dirname($path));
$subCollection = $this
->import($config['resource'], $type, false, $file);
/* @var $subCollection RouteCollection */
$subCollection
->addPrefix($prefix);
if (null !== $host) {
$subCollection
->setHost($host);
}
if (null !== $schemes) {
$subCollection
->setSchemes($schemes);
}
if (null !== $methods) {
$subCollection
->setMethods($methods);
}
$subCollection
->addDefaults($defaults);
$subCollection
->addRequirements($requirements);
$subCollection
->addOptions($options);
$collection
->addCollection($subCollection);
}