Skip to content

Commit 69cb889

Browse files
committed
Added stopwatch plugin
1 parent d42d86c commit 69cb889

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
@@ -218,6 +218,9 @@ private function configureClient(ContainerBuilder $container, $name, array $argu
218218
$pluginClientOptions = [];
219219

220220
if ($profiling) {
221+
// Add the stopwatch plugin
222+
array_unshift($arguments['plugins'], 'httplug.plugin.stopwatch');
223+
221224
// Tell the plugin journal what plugins we used
222225
$container
223226
->getDefinition('httplug.collector.plugin_journal')
@@ -340,6 +343,12 @@ private function registerAutoDiscoverableClient(ContainerBuilder $container, $na
340343
$pluginClientOptions = [];
341344

342345
if ($profiling) {
346+
// Tell the plugin journal what plugins we used
347+
$container
348+
->getDefinition('httplug.collector.plugin_journal')
349+
->addMethodCall('setPlugins', [$name, ['httplug.plugin.stopwatch']])
350+
;
351+
343352
$debugPluginServiceId = $this->registerDebugPlugin($container, $serviceId);
344353

345354
$pluginClientOptions['debug_plugins'] = [new Reference($debugPluginServiceId)];
@@ -348,7 +357,7 @@ private function registerAutoDiscoverableClient(ContainerBuilder $container, $na
348357
$container
349358
->register($serviceId, DummyClient::class)
350359
->setFactory([PluginClientFactory::class, 'createPluginClient'])
351-
->setArguments([[], $factory, [], $pluginClientOptions])
360+
->setArguments([[new Reference('httplug.plugin.stopwatch')], $factory, [], $pluginClientOptions])
352361
;
353362

354363
return $serviceId;

0 commit comments

Comments
 (0)