| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\HttpClient\DependencyInjection; |
| 13 |
|
| 14 |
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
| 15 |
use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 16 |
use Symfony\Component\DependencyInjection\ContainerInterface; |
| 17 |
use Symfony\Component\DependencyInjection\Reference; |
| 18 |
use Symfony\Component\HttpClient\TraceableHttpClient; |
| 19 |
|
| 20 |
final class HttpClientPass implements CompilerPassInterface |
| 21 |
{ |
| 22 |
public function process(ContainerBuilder $container): void |
| 23 |
{ |
| 24 |
if (!$container->hasDefinition('data_collector.http_client')) { |
| 25 |
return; |
| 26 |
} |
| 27 |
|
| 28 |
foreach ($container->findTaggedServiceIds('http_client.client') as $id => $tags) { |
| 29 |
$container->register('.debug.'.$id, TraceableHttpClient::class) |
| 30 |
->setDecoratedService($id, null, 100) |
| 31 |
->setArguments([new Reference('.inner'), new Reference('debug.stopwatch', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new Reference('profiler.is_disabled_state_checker', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]) |
| 32 |
->addTag('kernel.reset', ['method' => 'reset']); |
| 33 |
$container->getDefinition('data_collector.http_client') |
| 34 |
->addMethodCall('registerClient', [$id, new Reference('.debug.'.$id)]); |
| 35 |
} |
| 36 |
} |
| 37 |
} |