Skip to content

Commit 8bdbee1

Browse files
committed
Added stopwatch plugin
1 parent a5ef59a commit 8bdbee1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

DependencyInjection/HttplugExtension.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ private function configureClient(ContainerBuilder $container, $name, array $argu
217217
$pluginClientOptions = [];
218218

219219
if ($profiling) {
220+
// Add the stopwatch plugin
221+
array_unshift($arguments['plugins'], 'httplug.plugin.stopwatch');
222+
220223
// Tell the plugin journal what plugins we used
221224
$container
222225
->getDefinition('httplug.collector.plugin_journal')
@@ -330,6 +333,12 @@ private function registerAutoDiscoverableClient(ContainerBuilder $container, $na
330333
$pluginClientOptions = [];
331334

332335
if ($profiling) {
336+
// Tell the plugin journal what plugins we used
337+
$container
338+
->getDefinition('httplug.collector.plugin_journal')
339+
->addMethodCall('setPlugins', [$name, ['httplug.plugin.stopwatch']])
340+
;
341+
333342
$debugPluginServiceId = $this->registerDebugPlugin($container, $serviceId);
334343

335344
$pluginClientOptions['debug_plugins'] = [new Reference($debugPluginServiceId)];
@@ -338,7 +347,7 @@ private function registerAutoDiscoverableClient(ContainerBuilder $container, $na
338347
$container
339348
->register($serviceId, DummyClient::class)
340349
->setFactory([PluginClientFactory::class, 'createPluginClient'])
341-
->setArguments([[], $factory, [], $pluginClientOptions])
350+
->setArguments([[new Reference('httplug.plugin.stopwatch')], $factory, [], $pluginClientOptions])
342351
;
343352

344353
return $serviceId;

0 commit comments

Comments
 (0)