private function InlineServiceDefinitionsPass::inlineArguments in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php \Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass::inlineArguments()
Processes inline arguments.
Parameters
ContainerBuilder $container The ContainerBuilder:
array $arguments An array of arguments:
Return value
array
1 call to InlineServiceDefinitionsPass::inlineArguments()
- InlineServiceDefinitionsPass::process in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Compiler/ InlineServiceDefinitionsPass.php - Processes the ContainerBuilder for inline service definitions.
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Compiler/ InlineServiceDefinitionsPass.php, line 82
Class
- InlineServiceDefinitionsPass
- Inline service definitions where this is possible.
Namespace
Symfony\Component\DependencyInjection\CompilerCode
private function inlineArguments(ContainerBuilder $container, array $arguments) {
foreach ($arguments as $k => $argument) {
if (is_array($argument)) {
$arguments[$k] = $this
->inlineArguments($container, $argument);
}
elseif ($argument instanceof Reference) {
if (!$container
->hasDefinition($id = (string) $argument)) {
continue;
}
if ($this
->isInlineableDefinition($container, $id, $definition = $container
->getDefinition($id))) {
$this->compiler
->addLogMessage($this->formatter
->formatInlineService($this, $id, $this->currentId));
if (ContainerInterface::SCOPE_PROTOTYPE !== $definition
->getScope()) {
$arguments[$k] = $definition;
}
else {
$arguments[$k] = clone $definition;
}
}
}
elseif ($argument instanceof Definition) {
$argument
->setArguments($this
->inlineArguments($container, $argument
->getArguments()));
$argument
->setMethodCalls($this
->inlineArguments($container, $argument
->getMethodCalls()));
$argument
->setProperties($this
->inlineArguments($container, $argument
->getProperties()));
}
}
return $arguments;
}