5f009afdba22558eebe61a29d207d8ef0d2faee1
[yaffs-website] / web / modules / contrib / devel / webprofiler / src / Compiler / EventPass.php
1 <?php
2
3 namespace Drupal\webprofiler\Compiler;
4
5 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6 use Symfony\Component\DependencyInjection\ContainerBuilder;
7 use Symfony\Component\DependencyInjection\Reference;
8
9 /**
10  * Class EventPass.
11  */
12 class EventPass implements CompilerPassInterface {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function process(ContainerBuilder $container) {
18     $definition = $container->findDefinition('http_kernel.basic');
19     $definition->replaceArgument(1, new Reference('webprofiler.debug.controller_resolver'));
20
21     // Replace the regular event_dispatcher service with the debug one.
22     $definition = $container->findDefinition('event_dispatcher');
23     $definition->setPublic(FALSE);
24     $container->setDefinition('webprofiler.debug.event_dispatcher.default', $definition);
25     $container->register('event_dispatcher', 'Drupal\webprofiler\TraceableEventDispatcher')
26       ->addArgument(new Reference('webprofiler.debug.event_dispatcher.default'))
27       ->addArgument(new Reference('stopwatch'))
28       ->setProperty('_serviceId', 'event_dispatcher');
29   }
30 }