Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
16 | 1 | public function addClient( |
|
17 | string $name, |
||
18 | string $baseUri, |
||
19 | ClientRegistryInterface $clientRegistry, |
||
20 | array $defaults = [], |
||
21 | array $middlewares = [] |
||
22 | ) { |
||
23 | 1 | $handlerStack = new HandlerStack(new CurlHandler()); |
|
24 | |||
25 | 1 | foreach ($middlewares as $middleware) { |
|
26 | 1 | $handlerStack->push($middleware); |
|
27 | } |
||
28 | |||
29 | 1 | $clientRegistry->set( |
|
30 | 1 | $name, |
|
31 | 1 | new Client(['base_uri' => $baseUri, 'defaults' => $defaults, 'handler' => $handlerStack]) |
|
32 | ); |
||
33 | |||
34 | 1 | return $this; |
|
35 | } |
||
44 | } |