From 0d5fad706300b4b0cb50547d0ecf915ea3f09849 Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Mon, 6 Dec 2021 11:57:18 +0100 Subject: [PATCH] Rename the example config key to "example_config" The old name "secret_token" implied a bit that it is required for something, but it was just an example. This new name should make it more clear. --- README.md | 4 ++-- src/DependencyInjection/Configuration.php | 2 +- src/DependencyInjection/DbpRelayTemplateExtension.php | 2 +- src/Service/MyCustomService.php | 6 +++--- tests/Kernel.php | 2 +- tests/Service/ExternalApiTest.php | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 106889e..b09525a 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,8 @@ content: ```yaml dbp_relay_template: - secret_token: 42 - # secret_token: '%env(SECRET_TOKEN)%' + example_config: 42 + # example_config: '%env(EXAMPLE_CONFIG)%' ``` The value gets read in `DbpRelayTemplateExtension` and passed when creating the diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 8807043..5506ae2 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -15,7 +15,7 @@ class Configuration implements ConfigurationInterface $treeBuilder->getRootNode() ->children() - ->scalarNode('secret_token') + ->scalarNode('example_config') ->defaultValue('42') ->end() ->end(); diff --git a/src/DependencyInjection/DbpRelayTemplateExtension.php b/src/DependencyInjection/DbpRelayTemplateExtension.php index 2d55a11..93d457a 100644 --- a/src/DependencyInjection/DbpRelayTemplateExtension.php +++ b/src/DependencyInjection/DbpRelayTemplateExtension.php @@ -24,7 +24,7 @@ class DbpRelayTemplateExtension extends ConfigurableExtension // Inject the config value into the MyCustomService service $definition = $container->getDefinition('Dbp\Relay\TemplateBundle\Service\MyCustomService'); - $definition->addArgument($mergedConfig['secret_token']); + $definition->addArgument($mergedConfig['example_config']); } private function extendArrayParameter(ContainerBuilder $container, string $parameter, array $values) diff --git a/src/Service/MyCustomService.php b/src/Service/MyCustomService.php index 783a71c..b1817b0 100644 --- a/src/Service/MyCustomService.php +++ b/src/Service/MyCustomService.php @@ -6,10 +6,10 @@ namespace Dbp\Relay\TemplateBundle\Service; class MyCustomService { - private $token; + private $someConfig; - public function __construct(string $token) + public function __construct(string $someConfig) { - $this->token = $token; + $this->$someConfig = $someConfig; } } diff --git a/tests/Kernel.php b/tests/Kernel.php index 09c96dd..a2aa1c7 100644 --- a/tests/Kernel.php +++ b/tests/Kernel.php @@ -48,7 +48,7 @@ class Kernel extends BaseKernel ]); $container->extension('dbp_relay_template', [ - 'secret_token' => 'secret-test', + 'example_config' => 'test-42', ]); } } diff --git a/tests/Service/ExternalApiTest.php b/tests/Service/ExternalApiTest.php index f1a85ac..68211e5 100644 --- a/tests/Service/ExternalApiTest.php +++ b/tests/Service/ExternalApiTest.php @@ -14,7 +14,7 @@ class ExternalApiTest extends WebTestCase protected function setUp(): void { - $service = new MyCustomService('secret-test-custom'); + $service = new MyCustomService('test-42'); $this->api = new ExternalApi($service); } -- GitLab