You are here

public function InlineServiceDefinitionsPass::process in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php \Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass::process()

Processes the ContainerBuilder for inline service definitions.

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php, line 45

Class

InlineServiceDefinitionsPass
Inline service definitions where this is possible.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  $this->compiler = $container
    ->getCompiler();
  $this->formatter = $this->compiler
    ->getLoggingFormatter();
  $this->graph = $this->compiler
    ->getServiceReferenceGraph();
  foreach ($container
    ->getDefinitions() as $id => $definition) {
    $this->currentId = $id;
    $definition
      ->setArguments($this
      ->inlineArguments($container, $definition
      ->getArguments()));
    $definition
      ->setMethodCalls($this
      ->inlineArguments($container, $definition
      ->getMethodCalls()));
    $definition
      ->setProperties($this
      ->inlineArguments($container, $definition
      ->getProperties()));
    $configurator = $this
      ->inlineArguments($container, array(
      $definition
        ->getConfigurator(),
    ));
    $definition
      ->setConfigurator($configurator[0]);
    $factory = $this
      ->inlineArguments($container, array(
      $definition
        ->getFactory(),
    ));
    $definition
      ->setFactory($factory[0]);
  }
}