You are here

protected function YamlFileLoader::parseImport in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Loader/YamlFileLoader.php \Symfony\Component\Routing\Loader\YamlFileLoader::parseImport()

Parses an import and adds the routes in the resource to the RouteCollection.

Parameters

RouteCollection $collection A RouteCollection instance:

array $config Route definition:

string $path Full path of the YAML file being processed:

string $file Loaded file name:

1 call to YamlFileLoader::parseImport()
YamlFileLoader::load in vendor/symfony/routing/Loader/YamlFileLoader.php
Loads a Yaml file.

File

vendor/symfony/routing/Loader/YamlFileLoader.php, line 160

Class

YamlFileLoader
YamlFileLoader loads Yaml routing files.

Namespace

Symfony\Component\Routing\Loader

Code

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;
  $condition = isset($config['condition']) ? $config['condition'] : 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 !== $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);
}