3 namespace Drupal\Core\DependencyInjection\Compiler;
5 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6 use Symfony\Component\DependencyInjection\ContainerBuilder;
9 * Adds services tagged 'stream_wrapper' to the stream_wrapper_manager service.
11 class RegisterStreamWrappersPass implements CompilerPassInterface {
16 public function process(ContainerBuilder $container) {
17 if (!$container->hasDefinition('stream_wrapper_manager')) {
21 $stream_wrapper_manager = $container->getDefinition('stream_wrapper_manager');
23 foreach ($container->findTaggedServiceIds('stream_wrapper') as $id => $attributes) {
24 $class = $container->getDefinition($id)->getClass();
25 $scheme = $attributes[0]['scheme'];
27 $stream_wrapper_manager->addMethodCall('addStreamWrapper', [$id, $class, $scheme]);