private function PhpDumper::addServiceInlinedDefinitionsSetup

Generates the inline definition setup.

Parameters

string $id:

Definition $definition:

Return value

string

1 call to PhpDumper::addServiceInlinedDefinitionsSetup()
PhpDumper::addService in drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Adds a service

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php, line 428

Class

PhpDumper
PhpDumper dumps a service container as a PHP class.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

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;
    }
    $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;
}