public function YamlFileLoader::load

Same name in this branch

Loads a Yaml file.

Parameters

mixed $file The resource:

string $type The resource type:

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php, line 40

Class

YamlFileLoader
YamlFileLoader loads YAML files service definitions.

Namespace

Symfony\Component\DependencyInjection\Loader

Code

public function load($file, $type = null) {
  $path = $this->locator
    ->locate($file);
  $content = $this
    ->loadFile($path);
  $this->container
    ->addResource(new FileResource($path));

  // empty file
  if (null === $content) {
    return;
  }

  // imports
  $this
    ->parseImports($content, $file);

  // parameters
  if (isset($content['parameters'])) {
    foreach ($content['parameters'] as $key => $value) {
      $this->container
        ->setParameter($key, $this
        ->resolveServices($value));
    }
  }

  // extensions
  $this
    ->loadFromExtensions($content);

  // services
  $this
    ->parseDefinitions($content, $file);
}