Skip to content

Commit 5bfdb28

Browse files
committed
minor refactor
1 parent 868f77c commit 5bfdb28

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ClientFactory/PluginClientFactory.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ final class PluginClientFactory
2323
public static function createPluginClient(array $plugins, $factory, array $config, array $pluginClientOptions = [])
2424
{
2525
if ($factory instanceof ClientFactory) {
26-
return new PluginClient($factory->createClient($config), $plugins, $pluginClientOptions);
26+
$client = $factory->createClient($config);
2727
} elseif (is_callable($factory)) {
28-
return new PluginClient($factory($config), $plugins, $pluginClientOptions);
28+
$client = $factory($config);
29+
} else {
30+
throw new \RuntimeException(sprintf('Second argument to PluginClientFactory::createPluginClient must be a "%s" or a callale.', ClientFactory::class));
2931
}
3032

31-
throw new \RuntimeException(sprintf('Second argument to PluginClientFactory::createPluginClient must be a "%s" or a callale.', ClientFactory::class));
33+
return new PluginClient($client, $plugins, $pluginClientOptions);
3234
}
3335
}

0 commit comments

Comments
 (0)