| Total Complexity | 3 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | final class Client implements HttpClientInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * The HTTP client. |
||
| 16 | */ |
||
| 17 | private HttpClientInterface $httpClient; |
||
| 18 | |||
| 19 | public function __construct(?HttpClientInterface $httpClient = null) |
||
| 20 | { |
||
| 21 | $this->httpClient = $httpClient ?? new NativeHttpClient(); |
||
| 22 | } |
||
| 23 | |||
| 24 | public function request(string $method, string $url, array $options = []): ResponseInterface |
||
| 25 | { |
||
| 26 | $options['headers']['User-Agent'] = 'YAROC (http://github.com/drupol/yaroc)'; |
||
| 27 | |||
| 28 | return $this->httpClient->request($method, $url, $options); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function stream($responses, ?float $timeout = null): ResponseStreamInterface |
||
| 34 | } |
||
| 35 | } |
||
| 36 |