Skip to content

Commit

Permalink
Merge pull request #4 from krakphp/updating-bundle-to-use-config
Browse files Browse the repository at this point in the history
Updating Bundle to Use Config
  • Loading branch information
ragboyjr authored May 11, 2020
2 parents bb4b1e6 + 1566e15 commit 74374e7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/MessengerAutoScaleBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public function getAlias(): string {

/** @param mixed[] $configs */
public function load(array $configs, ContainerBuilder $container): void {
$processedConfig = $this->createProcessedConfiguration($configs);
$configuration = $this->getConfiguration($configs, $container);
$processedConfig = $this->processConfiguration($configuration, $configs);
$this->loadServices($container);

// processed pool config to be accessible as a parameter.
Expand All @@ -47,8 +48,8 @@ public function load(array $configs, ContainerBuilder $container): void {
->addArgument($processedConfig['console_path']);
}

private function createProcessedConfiguration(array $configs): array {
return $this->processConfiguration(new class() implements ConfigurationInterface {
public function getConfiguration(array $config, ContainerBuilder $container) {
return new class() implements ConfigurationInterface {
public function getConfigTreeBuilder() {
return configTree('messenger_auto_scale', struct([
'console_path' => string(['configure' => function(ScalarNodeDefinition $def) {
Expand All @@ -70,7 +71,7 @@ public function getConfigTreeBuilder() {
], ['allowExtraKeys' => true]))
]));
}
}, $configs);
};
}

private function loadServices(ContainerBuilder $container): void {
Expand Down

0 comments on commit 74374e7

Please sign in to comment.