protected function YamlFileLoader::loadFile
protected YamlFileLoader::loadFile($file)
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.
File
- core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php, line 324
Class
- YamlFileLoader
- YamlFileLoader loads YAML files service definitions.
Namespace
Drupal\Core\DependencyInjectionCode
protected function loadFile($file) { 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)); } return $this->validate(Yaml::decode(file_get_contents($file)), $file); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!DependencyInjection!YamlFileLoader.php/function/YamlFileLoader::loadFile/8.1.x