class StreamWrapperClassesPass
Same name and namespace in other branches
- main core/lib/Drupal/Core/DependencyInjection/Compiler/StreamWrapperClassesPass.php \Drupal\Core\DependencyInjection\Compiler\StreamWrapperClassesPass
Collects the classes of services tagged 'stream_wrapper'.
Stream wrapper classes have to be registered with PHP by class name, as PHP instantiates stream wrappers itself without dependency injection. Collecting the class names at compile time allows the stream wrapper manager to register wrappers without instantiating the individual services.
Hierarchy
- class \Drupal\Core\DependencyInjection\Compiler\StreamWrapperClassesPass implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface
Expanded class hierarchy of StreamWrapperClassesPass
1 file declares its use of StreamWrapperClassesPass
- CoreServiceProvider.php in core/
lib/ Drupal/ Core/ CoreServiceProvider.php
File
-
core/
lib/ Drupal/ Core/ DependencyInjection/ Compiler/ StreamWrapperClassesPass.php, line 18
Namespace
Drupal\Core\DependencyInjection\CompilerView source
class StreamWrapperClassesPass implements CompilerPassInterface {
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container) : void {
if (!$container->hasDefinition('stream_wrapper_manager')) {
return;
}
$wrapper_classes = [];
foreach ($container->findTaggedServiceIds('stream_wrapper') as $id => $tags) {
$class = $container->getDefinition($id)
->getClass();
foreach ($tags as $attributes) {
$wrapper_classes[$attributes['scheme']] = $class;
}
}
$container->getDefinition('stream_wrapper_manager')
->setArgument('$wrapperClasses', $wrapper_classes);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.