Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 9 |
| RegisterServicesForDestructionPass | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 9 |
| process | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 9 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass. | |
| */ | |
| namespace Drupal\Core\DependencyInjection\Compiler; | |
| use Symfony\Component\DependencyInjection\ContainerBuilder; | |
| use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | |
| /** | |
| * Adds services tagged "needs_destruction" to the "kernel_destruct_subscriber" | |
| * service. | |
| * | |
| * @see \Drupal\Core\DestructableInterface | |
| */ | |
| class RegisterServicesForDestructionPass implements CompilerPassInterface { | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function process(ContainerBuilder $container) { | |
| if (!$container->hasDefinition('kernel_destruct_subscriber')) { | |
| return; | |
| } | |
| $definition = $container->getDefinition('kernel_destruct_subscriber'); | |
| $services = $container->findTaggedServiceIds('needs_destruction'); | |
| foreach ($services as $id => $attributes) { | |
| $definition->addMethodCall('registerService', array($id)); | |
| } | |
| } | |
| } |