You are here

private function PhpDumper::getServiceCall in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/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 vendor/symfony/dependency-injection/Dumper/PhpDumper.php
PhpDumper::addServiceLocalTempVariables in vendor/symfony/dependency-injection/Dumper/PhpDumper.php
Generates Service local temp variables.
PhpDumper::dumpValue in vendor/symfony/dependency-injection/Dumper/PhpDumper.php
Dumps values.

File

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

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