You are here

private function PhpDumper::addServiceInclude in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/Dumper/PhpDumper.php \Symfony\Component\DependencyInjection\Dumper\PhpDumper::addServiceInclude()

Generates the require_once statement for service includes.

Parameters

string $id The service id:

Definition $definition:

Return value

string

1 call to PhpDumper::addServiceInclude()
PhpDumper::addService in vendor/symfony/dependency-injection/Dumper/PhpDumper.php
Adds a service.

File

vendor/symfony/dependency-injection/Dumper/PhpDumper.php, line 252

Class

PhpDumper
PhpDumper dumps a service container as a PHP class.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function addServiceInclude($id, $definition) {
  $template = "        require_once %s;\n";
  $code = '';
  if (null !== ($file = $definition
    ->getFile())) {
    $code .= sprintf($template, $this
      ->dumpValue($file));
  }
  foreach ($this
    ->getInlinedDefinitions($definition) as $definition) {
    if (null !== ($file = $definition
      ->getFile())) {
      $code .= sprintf($template, $this
        ->dumpValue($file));
    }
  }
  if ('' !== $code) {
    $code .= "\n";
  }
  return $code;
}