YamlFileLoader::parseDefinitions

private YamlFileLoader::parseDefinitions($content, $file)

Parses definitions

Parameters

array $content:

string $file:

File

core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php, line 104

Class

YamlFileLoader
YamlFileLoader loads YAML files service definitions.

Namespace

Drupal\Core\DependencyInjection

Code

private function parseDefinitions($content, $file) 
 {
  if (!isset($content['services'])) {
    return;
  }

  if (!is_array($content['services'])) {
    throw new InvalidArgumentException(sprintf('The "services" key should contain an array in %s. Check your YAML syntax.', $file));
  }

  // Some extensions split up their dependencies into multiple files.
  if (isset($content['_provider'])) {
    $provider = $content['_provider'];
  }
  else {
    $basename = basename($file);
    list($provider, ) = explode('.', $basename, 2);
  }
  foreach ($content['services'] as $id => $service) {
    $service['tags'][] = ['name' => '_provider', 'provider' => $provider];
    $this->parseDefinition($id, $service, $file);
  }
}
doc_Drupal
2016-10-29 09:57:00
Comments
Leave a Comment

Please login to continue.