Conditions | 4 |
Paths | 3 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
50 | public function createClient($client): PluginClient |
||
51 | { |
||
52 | if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { |
||
53 | throw new \RuntimeException('You must provide a valid http client'); |
||
54 | } |
||
55 | |||
56 | $plugins = $this->plugins; |
||
57 | |||
58 | if (0 === count($plugins)) { |
||
59 | $plugins[] = []; |
||
60 | } |
||
61 | |||
62 | krsort($plugins); |
||
63 | $plugins = array_merge(...$plugins); |
||
64 | |||
65 | return new PluginClient( |
||
66 | $client, |
||
67 | array_values($plugins), |
||
68 | $this->options |
||
69 | ); |
||
70 | } |
||
71 | } |
||
72 |