You are here

private function PhpDumper::addServiceInclude in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/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 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Adds a service.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php, line 258

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