Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public static function createHttpClient(string $chatworkToken, array $middlewares = []): \GuzzleHttp\Client |
||
46 | { |
||
47 | $stack = new HandlerStack(); |
||
48 | $stack->push(Middleware::mapRequest(static fn (RequestInterface $request) => $request->withHeader('X-ChatWorkToken', $chatworkToken))); |
||
49 | foreach ($middlewares as $middleware) { |
||
50 | $stack->push($middleware); |
||
51 | } |
||
52 | |||
53 | $options = array_merge(self::$httpOptions, [ |
||
54 | 'handler' => $stack, |
||
55 | ]); |
||
56 | return new \GuzzleHttp\Client($options); |
||
57 | } |
||
59 |