protected function YamlFileLoader::loadFile

Same name in this branch
  1. 8.x drupal/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php \Drupal\Core\DependencyInjection\YamlFileLoader::loadFile()
  2. 8.x drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::loadFile()

Loads a YAML file.

Parameters

string $file:

Return value

array The file content

1 call to YamlFileLoader::loadFile()
YamlFileLoader::load in drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
Loads a Yaml file.

File

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

Class

YamlFileLoader
YamlFileLoader loads YAML files service definitions.

Namespace

Symfony\Component\DependencyInjection\Loader

Code

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));
  }
  if (null === $this->yamlParser) {
    $this->yamlParser = new YamlParser();
  }
  return $this
    ->validate($this->yamlParser
    ->parse(file_get_contents($file)), $file);
}