private function YamlDumper::addServices in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dependency-injection/Dumper/YamlDumper.php \Symfony\Component\DependencyInjection\Dumper\YamlDumper::addServices()
Adds services.
Return value
string
1 call to YamlDumper::addServices()
- YamlDumper::dump in vendor/
symfony/ dependency-injection/ Dumper/ YamlDumper.php - Dumps the service container as an YAML string.
File
- vendor/
symfony/ dependency-injection/ Dumper/ YamlDumper.php, line 176
Class
- YamlDumper
- YamlDumper dumps a service container as a YAML string.
Namespace
Symfony\Component\DependencyInjection\DumperCode
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;
}