function YamlFileLoader::load
Same name in this branch
- 11.1.x vendor/symfony/routing/Loader/YamlFileLoader.php \Symfony\Component\Routing\Loader\YamlFileLoader::load()
- 11.1.x core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php \Drupal\Core\DependencyInjection\YamlFileLoader::load()
File
-
vendor/
symfony/ dependency-injection/ Loader/ YamlFileLoader.php, line 119
Class
- YamlFileLoader
- YamlFileLoader loads YAML files service definitions.
Namespace
Symfony\Component\DependencyInjection\LoaderCode
public function load(mixed $resource, ?string $type = null) : mixed {
$path = $this->locator
->locate($resource);
$content = $this->loadFile($path);
$this->container
->fileExists($path);
// empty file
if (null === $content) {
return null;
}
++$this->importing;
try {
$this->loadContent($content, $path);
// per-env configuration
if ($this->env && isset($content['when@' . $this->env])) {
if (!\is_array($content['when@' . $this->env])) {
throw new InvalidArgumentException(\sprintf('The "when@%s" key should contain an array in "%s". Check your YAML syntax.', $this->env, $path));
}
$env = $this->env;
$this->env = null;
try {
$this->loadContent($content['when@' . $env], $path);
} finally {
$this->env = $env;
}
}
} finally {
--$this->importing;
}
$this->loadExtensionConfigs();
return null;
}