Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
29 | public static function createPluginClient(array $plugins, $factory, array $config, array $pluginClientOptions = []) |
||
30 | { |
||
31 | if ($factory instanceof ClientFactory) { |
||
32 | $client = $factory->createClient($config); |
||
33 | } elseif (is_callable($factory)) { |
||
34 | $client = $factory($config); |
||
35 | } else { |
||
36 | throw new \RuntimeException(sprintf('Second argument to PluginClientFactory::createPluginClient must be a "%s" or a callable.', ClientFactory::class)); |
||
37 | } |
||
38 | |||
39 | return new PluginClient($client, $plugins, $pluginClientOptions); |
||
40 | } |
||
41 | } |
||
42 |
If you suppress an error, we recommend checking for the error condition explicitly: