private function PhpDumper::addServiceInlinedDefinitionsSetup in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/dependency-injection/Dumper/PhpDumper.php \Symfony\Component\DependencyInjection\Dumper\PhpDumper::addServiceInlinedDefinitionsSetup()
Generates the inline definition setup.
Parameters
string $id:
Definition $definition:
Return value
string
Throws
ServiceCircularReferenceException when the container contains a circular reference
1 call to PhpDumper::addServiceInlinedDefinitionsSetup()
- PhpDumper::addService in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - Adds a service.
File
- vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php, line 476
Class
- PhpDumper
- PhpDumper dumps a service container as a PHP class.
Namespace
Symfony\Component\DependencyInjection\DumperCode
private function addServiceInlinedDefinitionsSetup($id, $definition) {
$this->referenceVariables[$id] = new Variable('instance');
$code = '';
$processed = new \SplObjectStorage();
foreach ($this
->getInlinedDefinitions($definition) as $iDefinition) {
if ($processed
->contains($iDefinition)) {
continue;
}
$processed
->offsetSet($iDefinition);
if (!$this
->hasReference($id, $iDefinition
->getMethodCalls(), true) && !$this
->hasReference($id, $iDefinition
->getProperties(), true)) {
continue;
}
// if the instance is simple, the return statement has already been generated
// so, the only possible way to get there is because of a circular reference
if ($this
->isSimpleInstance($id, $definition)) {
throw new ServiceCircularReferenceException($id, array(
$id,
));
}
$name = (string) $this->definitionVariables
->offsetGet($iDefinition);
$code .= $this
->addServiceMethodCalls(null, $iDefinition, $name);
$code .= $this
->addServiceProperties(null, $iDefinition, $name);
$code .= $this
->addServiceConfigurator(null, $iDefinition, $name);
}
if ('' !== $code) {
$code .= "\n";
}
return $code;
}