You are here

private function YamlFileLoader::parseImports in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::parseImports()

Parses all imports.

Parameters

array $content:

string $file:

1 call to YamlFileLoader::parseImports()
YamlFileLoader::load in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php, line 87

Class

YamlFileLoader
YamlFileLoader loads YAML files service definitions.

Namespace

Symfony\Component\DependencyInjection\Loader

Code

private function parseImports($content, $file) {
  if (!isset($content['imports'])) {
    return;
  }
  if (!is_array($content['imports'])) {
    throw new InvalidArgumentException(sprintf('The "imports" key should contain an array in %s. Check your YAML syntax.', $file));
  }
  foreach ($content['imports'] as $import) {
    if (!is_array($import)) {
      throw new InvalidArgumentException(sprintf('The values in the "imports" key should be arrays in %s. Check your YAML syntax.', $file));
    }
    $this
      ->setCurrentDir(dirname($file));
    $this
      ->import($import['resource'], null, isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false, $file);
  }
}