protected function YamlFileLoader::loadFile in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/dependency-injection/Loader/YamlFileLoader.php \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::loadFile()
- 8 core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php \Drupal\Core\DependencyInjection\YamlFileLoader::loadFile()
Same name and namespace in other branches
- 8.0 vendor/symfony/dependency-injection/Loader/YamlFileLoader.php \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::loadFile()
Loads a YAML file.
Parameters
string $file:
Return value
array The file content
Throws
InvalidArgumentException when the given file is not a local file or when it does not exist
1 call to YamlFileLoader::loadFile()
- YamlFileLoader::load in vendor/
symfony/ dependency-injection/ Loader/ YamlFileLoader.php
File
- vendor/
symfony/ dependency-injection/ Loader/ YamlFileLoader.php, line 302
Class
- YamlFileLoader
- YamlFileLoader loads YAML files service definitions.
Namespace
Symfony\Component\DependencyInjection\LoaderCode
protected function loadFile($file) {
if (!class_exists('Symfony\\Component\\Yaml\\Parser')) {
throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.');
}
if (!stream_is_local($file)) {
throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file));
}
if (!file_exists($file)) {
throw new InvalidArgumentException(sprintf('The service file "%s" is not valid.', $file));
}
if (null === $this->yamlParser) {
$this->yamlParser = new YamlParser();
}
try {
$configuration = $this->yamlParser
->parse(file_get_contents($file));
} catch (ParseException $e) {
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
}
return $this
->validate($configuration, $file);
}