Skip to content

Commit 838a775

Browse files
committed
Typos and let the toolbar "canBeDisabled"
1 parent 115d07e commit 838a775

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

DependencyInjection/Configuration.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@ public function getConfigTreeBuilder()
7272
->scalarNode('stream_factory')->defaultNull()->end()
7373
->end()
7474
->end()
75-
->booleanNode('toolbar')->defaultTrue()->end()
75+
->arrayNode('toolbar')
76+
->canBeDisabled()
77+
->addDefaultsIfNotSet()
78+
->children()
79+
->scalarNode('formatter')->defaultValue('httplug.collector.message_journal')->end()
80+
->end()
81+
->end()
7682
->end()
7783
;
7884

DependencyInjection/HttplugExtension.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ public function load(array $configs, ContainerBuilder $container)
2727
$loader->load('services.xml');
2828
$loader->load('plugins.xml');
2929
$loader->load('discovery.xml');
30-
if ($config['toolbar'] && $container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) {
30+
if ($config['toolbar']['enabled'] && $container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) {
3131
$loader->load('data-collector.xml');
32+
$container->getDefinition('httplug.collector.history_plugin')
33+
->replaceArgument(0, new Reference($config['toolbar']['formatter']));
3234
$config['_inject_journal_plugin'] = true;
3335
}
3436

@@ -62,7 +64,7 @@ protected function configureClients(ContainerBuilder $container, array $config)
6264
}
6365

6466
if (isset($config['_inject_journal_plugin'])) {
65-
array_unshift($arguments['plugins'], 'httplug.plugin.history');
67+
array_unshift($arguments['plugins'], 'httplug.collector.history_plugin');
6668
}
6769

6870
$def = $container->register('httplug.client.'.$name, DummyClient::class);

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ For information how to write applications with the services provided by this bun
5151
| httplug.stream_factory | Service* that provides the `Http\Message\StreamFactory`
5252
| httplug.client.[name] | This is your Httpclient that you have configured. With the configuration below the name would be `acme_client`.
5353
| httplug.client | This is the first client configured or a client named `default`.
54-
| httplug.plugin.content_length <br> httplug.plugin.decoder<br> httplug.plugin.error<br> httplug.plugin.history<br> httplug.plugin.logger<br> httplug.plugin.redirect<br> httplug.plugin.retry | These are built in plugins that lives in the `php-http/plugins` package. These servcies are not public and may only be used when configure HttpClients or services.<br><br>*The History plugin is only available when the kernel runs on debug mode and `httplug.toolbar: true`. It gets automatically injected to all clients.*
54+
| httplug.plugin.content_length <br> httplug.plugin.decoder<br> httplug.plugin.error<br> httplug.plugin.logger<br> httplug.plugin.redirect<br> httplug.plugin.retry | These are built in plugins that live in the `php-http/plugins` package. These servcies are not public and may only be used when configure HttpClients or services.
5555

5656
\* *These services are always an alias to another service. You can specify your own service or leave the default, which is the same name with `.default` appended. The default services in turn use the service discovery mechanism to provide the best available implementation. You can specify a class for each of the default services to use instead of discovery, as long as those classes can be instantiated without arguments.*
5757

Resources/config/data-collector.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55

66
<services>
7-
<service id="httplug.message_journal" class="Http\HttplugBundle\Collector\MessageJournal" public="false">
7+
<service id="httplug.collector.message_journal" class="Http\HttplugBundle\Collector\MessageJournal" public="false">
88
<tag name="data_collector" template="HttplugBundle::webprofiler.html.twig" priority="200"
99
id="httplug"/>
1010
</service>
1111

12-
<service id="httplug.plugin.history" class="Http\Client\Plugin\HistoryPlugin" public="false">
13-
<argument type="service" id="httplug.message_journal"/>
12+
<service id="httplug.collector.history_plugin" class="Http\Client\Plugin\HistoryPlugin" public="false">
13+
<argument />
1414
</service>
1515
</services>
1616
</container>

0 commit comments

Comments
 (0)