Version 1
[yaffs-website] / web / modules / contrib / devel / webprofiler / src / Compiler / StoragePass.php
1 <?php
2
3 namespace Drupal\webprofiler\Compiler;
4
5 use Symfony\Component\DependencyInjection\Reference;
6 use Symfony\Component\DependencyInjection\ContainerBuilder;
7 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
9 /**
10  * Class StoragePass
11  */
12 class StoragePass implements CompilerPassInterface {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function process(ContainerBuilder $container) {
18     if (FALSE === $container->hasDefinition('profiler.storage_manager')) {
19       return;
20     }
21
22     $definition = $container->getDefinition('profiler.storage_manager');
23
24     foreach ($container->findTaggedServiceIds('webprofiler_storage') as $id => $attributes) {
25       $definition->addMethodCall('addStorage', [
26         $id,
27         $attributes[0]['title'],
28         new Reference($id)
29       ]);
30     }
31   }
32 }