| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function sendRequest(RequestInterface $request):ResponseInterface{ |
||
| 26 | $stream = $this->streamFactory?->createStream(); |
||
| 27 | $this->handle = new CurlHandle($request, $this->responseFactory->createResponse(), $this->options, $stream); |
||
| 28 | $errno = $this->handle->exec(); |
||
| 29 | |||
| 30 | if($errno !== CURLE_OK){ |
||
| 31 | $error = $this->handle->getError(); |
||
| 32 | |||
| 33 | $this->logger->error(sprintf('cURL error #%s: %s', $errno, $error)); |
||
| 34 | |||
| 35 | if(in_array($errno, $this->handle::CURL_NETWORK_ERRORS, true)){ |
||
| 36 | throw new NetworkException($error, $request); |
||
| 37 | } |
||
| 38 | |||
| 39 | throw new RequestException($error, $request); |
||
| 40 | } |
||
| 41 | |||
| 42 | $this->handle->close(); |
||
| 43 | |||
| 44 | return $this->handle->getResponse(); |
||
| 45 | } |
||
| 48 |