class RegisterNestedMatchersPass

Adds services tagged 'nested_matcher' to the tagged_matcher service.

Hierarchy

Expanded class hierarchy of RegisterNestedMatchersPass

1 file declares its use of RegisterNestedMatchersPass
CoreBundle.php in drupal/core/lib/Drupal/Core/CoreBundle.php
Definition of Drupal\Core\CoreBundle.

File

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

Namespace

Drupal\Core\DependencyInjection\Compiler
View source
class RegisterNestedMatchersPass implements CompilerPassInterface {

  /**
   * Adds services tagged 'nested_matcher' to the tagged_matcher service.
   *
   * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
   *   The container to process.
   */
  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),
      ));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RegisterNestedMatchersPass::process public function Adds services tagged 'nested_matcher' to the tagged_matcher service. Overrides CompilerPassInterface::process