protected function XmlFileLoader::parseImport in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/routing/Loader/XmlFileLoader.php \Symfony\Component\Routing\Loader\XmlFileLoader::parseImport()
Parses an import and adds the routes in the resource to the RouteCollection.
Parameters
RouteCollection $collection RouteCollection instance:
\DOMElement $node Element to parse that represents a Route:
string $path Full path of the XML file being processed:
string $file Loaded file name:
Throws
\InvalidArgumentException When the XML is invalid
1 call to XmlFileLoader::parseImport()
- XmlFileLoader::parseNode in vendor/
symfony/ routing/ Loader/ XmlFileLoader.php - Parses a node from a loaded XML file.
File
- vendor/
symfony/ routing/ Loader/ XmlFileLoader.php, line 162
Class
- XmlFileLoader
- XmlFileLoader loads XML routing files.
Namespace
Symfony\Component\Routing\LoaderCode
protected function parseImport(RouteCollection $collection, \DOMElement $node, $path, $file) {
if ('' === ($resource = $node
->getAttribute('resource'))) {
throw new \InvalidArgumentException(sprintf('The <import> element in file "%s" must have a "resource" attribute.', $path));
}
$type = $node
->getAttribute('type');
$prefix = $node
->getAttribute('prefix');
$host = $node
->hasAttribute('host') ? $node
->getAttribute('host') : null;
$schemes = $node
->hasAttribute('schemes') ? preg_split('/[\\s,\\|]++/', $node
->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY) : null;
$methods = $node
->hasAttribute('methods') ? preg_split('/[\\s,\\|]++/', $node
->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY) : null;
list($defaults, $requirements, $options, $condition) = $this
->parseConfigs($node, $path);
$this
->setCurrentDir(dirname($path));
$subCollection = $this
->import($resource, '' !== $type ? $type : null, false, $file);
/* @var $subCollection RouteCollection */
$subCollection
->addPrefix($prefix);
if (null !== $host) {
$subCollection
->setHost($host);
}
if (null !== $condition) {
$subCollection
->setCondition($condition);
}
if (null !== $schemes) {
$subCollection
->setSchemes($schemes);
}
if (null !== $methods) {
$subCollection
->setMethods($methods);
}
$subCollection
->addDefaults($defaults);
$subCollection
->addRequirements($requirements);
$subCollection
->addOptions($options);
$collection
->addCollection($subCollection);
}