| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | public static function createHttpClient(string $chatworkToken, array $middlewares = []): \GuzzleHttp\Client |
||
| 32 | { |
||
| 33 | $stack = new HandlerStack(); |
||
| 34 | $stack->setHandler(new CurlHandler()); |
||
| 35 | $stack->push(Middleware::mapRequest(static fn (RequestInterface $request) => $request->withHeader('X-ChatWorkToken', $chatworkToken))); |
||
| 36 | foreach ($middlewares as $middleware) { |
||
| 37 | $stack->push($middleware); |
||
| 38 | } |
||
| 39 | |||
| 40 | $options = array_merge(self::$httpOptions, ['handler' => $stack]); |
||
| 41 | return new \GuzzleHttp\Client($options); |
||
| 42 | } |
||
| 44 |