You are here

private function XmlDumper::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/XmlDumper.php \Symfony\Component\DependencyInjection\Dumper\XmlDumper::addServices()

Adds services.

Parameters

\DOMElement $parent:

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

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php, line 235

Class

XmlDumper
XmlDumper dumps a service container as an XML string.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function addServices(\DOMElement $parent) {
  $definitions = $this->container
    ->getDefinitions();
  if (!$definitions) {
    return;
  }
  $services = $this->document
    ->createElement('services');
  foreach ($definitions as $id => $definition) {
    $this
      ->addService($definition, $id, $services);
  }
  $aliases = $this->container
    ->getAliases();
  foreach ($aliases as $alias => $id) {
    while (isset($aliases[(string) $id])) {
      $id = $aliases[(string) $id];
    }
    $this
      ->addServiceAlias($alias, $id, $services);
  }
  $parent
    ->appendChild($services);
}