DumpDataCollectorPass.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\DebugBundle\DependencyInjection\Compiler;
  11. use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener;
  12. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  13. use Symfony\Component\DependencyInjection\ContainerBuilder;
  14. /**
  15. * Registers the file link format for the {@link \Symfony\Component\HttpKernel\DataCollector\DumpDataCollector}.
  16. *
  17. * @author Christian Flothmann <christian.flothmann@xabbuh.de>
  18. */
  19. class DumpDataCollectorPass implements CompilerPassInterface
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function process(ContainerBuilder $container)
  25. {
  26. if (!$container->hasDefinition('data_collector.dump')) {
  27. return;
  28. }
  29. $definition = $container->getDefinition('data_collector.dump');
  30. if (!$container->hasParameter('web_profiler.debug_toolbar.mode') || WebDebugToolbarListener::DISABLED === $container->getParameter('web_profiler.debug_toolbar.mode')) {
  31. $definition->replaceArgument(3, null);
  32. }
  33. }
  34. }