You are here

private function YamlDumper::addServices in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php \Symfony\Component\DependencyInjection\Dumper\YamlDumper::addServices()

Adds services.

Return value

string

1 call to YamlDumper::addServices()
YamlDumper::dump in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
Dumps the service container as an YAML string.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php, line 176

Class

YamlDumper
YamlDumper dumps a service container as a YAML string.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function addServices() {
  if (!$this->container
    ->getDefinitions()) {
    return '';
  }
  $code = "services:\n";
  foreach ($this->container
    ->getDefinitions() as $id => $definition) {
    $code .= $this
      ->addService($id, $definition);
  }
  $aliases = $this->container
    ->getAliases();
  foreach ($aliases as $alias => $id) {
    while (isset($aliases[(string) $id])) {
      $id = $aliases[(string) $id];
    }
    $code .= $this
      ->addServiceAlias($alias, $id);
  }
  return $code;
}