You are here

class RegisterStreamWrappersPass in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterStreamWrappersPass

Adds services tagged 'stream_wrapper' to the stream_wrapper_manager service.

Hierarchy

Expanded class hierarchy of RegisterStreamWrappersPass

File

lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php, line 18
Contains \Drupal\Core\DependencyInjection\Compiler\RegisterStreamWrappersPass.

Namespace

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

  /**
   * {@inheritdoc}
   */
  public function process(ContainerBuilder $container) {
    if (!$container
      ->hasDefinition('stream_wrapper_manager')) {
      return;
    }
    $stream_wrapper_manager = $container
      ->getDefinition('stream_wrapper_manager');
    foreach ($container
      ->findTaggedServiceIds('stream_wrapper') as $id => $attributes) {
      $class = $container
        ->getDefinition($id)
        ->getClass();
      $scheme = $attributes[0]['scheme'];
      $stream_wrapper_manager
        ->addMethodCall('addStreamWrapper', array(
        $id,
        $class,
        $scheme,
      ));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RegisterStreamWrappersPass::process public function You can modify the container here before it is dumped to PHP code. Overrides CompilerPassInterface::process