Skip to content

Commit

Permalink
Store references in plugins array
Browse files Browse the repository at this point in the history
  • Loading branch information
ruudk committed Nov 18, 2024
1 parent fb077ec commit 9bced40
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/DependencyInjection/HttplugExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,29 @@ private function configureClient(ContainerBuilder $container, string $clientName

switch ($pluginName) {
case 'reference':
$plugins[] = $pluginConfig['id'];
$plugins[] = new Reference($pluginConfig['id']);
break;
case 'authentication':
$plugins = array_merge($plugins, $this->configureAuthentication($container, $pluginConfig, $serviceId.'.authentication'));
$plugins = array_merge(
$plugins,
array_map(
fn ($id) => new Reference($id),
$this->configureAuthentication($container, $pluginConfig, $serviceId.'.authentication')
)
);
break;
case 'vcr':
$this->useVcrPlugin = true;
$plugins = array_merge($plugins, $this->configureVcrPlugin($container, $pluginConfig, $serviceId.'.vcr'));
$plugins = array_merge(
$plugins,
array_map(
fn ($id) => new Reference($id),
$this->configureVcrPlugin($container, $pluginConfig, $serviceId.'.vcr'),
),
);
break;
default:
$plugins[] = $this->configurePlugin($container, $serviceId, $pluginName, $pluginConfig);
$plugins[] = new Reference($this->configurePlugin($container, $serviceId, $pluginName, $pluginConfig));
}
}

Expand All @@ -456,12 +468,7 @@ private function configureClient(ContainerBuilder $container, string $clientName
->register($serviceId, PluginClient::class)
->setFactory([new Reference(PluginClientFactory::class), 'createClient'])
->addArgument(new Reference($serviceId.'.client'))
->addArgument(
array_map(
fn ($id) => new Reference($id),
$plugins
)
)
->addArgument($plugins)
->addArgument([
'client_name' => $clientName,
])
Expand Down

0 comments on commit 9bced40

Please sign in to comment.