You are here

private function PhpDumper::getServiceCall in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php \Symfony\Component\DependencyInjection\Dumper\PhpDumper::getServiceCall()

Gets a service call.

Parameters

string $id:

Reference $reference:

Return value

string

3 calls to PhpDumper::getServiceCall()
PhpDumper::addNewInstance in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
PhpDumper::addServiceLocalTempVariables in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Generates Service local temp variables.
PhpDumper::dumpValue in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Dumps values.

File

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

Class

PhpDumper
PhpDumper dumps a service container as a PHP class.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function getServiceCall($id, Reference $reference = null) {
  if ('service_container' === $id) {
    return '$this';
  }
  if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference
    ->getInvalidBehavior()) {
    return sprintf('$this->get(\'%s\', ContainerInterface::NULL_ON_INVALID_REFERENCE)', $id);
  }
  else {
    if ($this->container
      ->hasAlias($id)) {
      $id = (string) $this->container
        ->getAlias($id);
    }
    return sprintf('$this->get(\'%s\')', $id);
  }
}