private function PhpDumper::addServiceConfigurator in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php \Symfony\Component\DependencyInjection\Dumper\PhpDumper::addServiceConfigurator()
Adds configurator definition.
Parameters
string $id:
Definition $definition:
string $variableName:
Return value
string
3 calls to PhpDumper::addServiceConfigurator()
- PhpDumper::addService in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Dumper/ PhpDumper.php - Adds a service.
- PhpDumper::addServiceInlinedDefinitions in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Dumper/ PhpDumper.php - Generates the inline definition of a service.
- PhpDumper::addServiceInlinedDefinitionsSetup in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Dumper/ PhpDumper.php - Generates the inline definition setup.
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Dumper/ PhpDumper.php, line 520
Class
- PhpDumper
- PhpDumper dumps a service container as a PHP class.
Namespace
Symfony\Component\DependencyInjection\DumperCode
private function addServiceConfigurator($id, $definition, $variableName = 'instance') {
if (!($callable = $definition
->getConfigurator())) {
return '';
}
if (is_array($callable)) {
if ($callable[0] instanceof Reference || $callable[0] instanceof Definition && $this->definitionVariables
->contains($callable[0])) {
return sprintf(" %s->%s(\$%s);\n", $this
->dumpValue($callable[0]), $callable[1], $variableName);
}
$class = $this
->dumpValue($callable[0]);
// If the class is a string we can optimize call_user_func away
if (strpos($class, "'") === 0) {
return sprintf(" %s::%s(\$%s);\n", $this
->dumpLiteralClass($class), $callable[1], $variableName);
}
return sprintf(" call_user_func(array(%s, '%s'), \$%s);\n", $this
->dumpValue($callable[0]), $callable[1], $variableName);
}
return sprintf(" %s(\$%s);\n", $callable, $variableName);
}