public function RegisterNestedMatchersPass::process

Adds services tagged 'nested_matcher' to the tagged_matcher service.

Parameters

\Symfony\Component\DependencyInjection\ContainerBuilder $container: The container to process.

Overrides CompilerPassInterface::process

File

drupal/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterNestedMatchersPass.php, line 25
Contains Drupal\Core\DependencyInjection\Compiler\RegisterNestedMatchersPass.

Class

RegisterNestedMatchersPass
Adds services tagged 'nested_matcher' to the tagged_matcher service.

Namespace

Drupal\Core\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  if (!$container
    ->hasDefinition('nested_matcher')) {
    return;
  }
  $nested = $container
    ->getDefinition('nested_matcher');
  foreach ($container
    ->findTaggedServiceIds('nested_matcher') as $id => $attributes) {
    $method = $attributes[0]['method'];
    $nested
      ->addMethodCall($method, array(
      new Reference($id),
    ));
  }
}