| Conditions | 4 |
| Paths | 12 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 4 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 59 | public function sendRequest(RequestInterface $request, array $options = []): ResponseInterface |
|
| 16 | { |
||
| 17 | 59 | $options = $this->validateOptions($options); |
|
| 18 | 58 | $curl = $this->createHandle(); |
|
| 19 | 58 | $responseBuilder = $this->prepare($curl, $request, $options); |
|
| 20 | |||
| 21 | 58 | $curlInfo = null; |
|
| 22 | try { |
||
| 23 | 58 | curl_exec($curl); |
|
| 24 | 58 | $this->parseError($request, curl_errno($curl), $curl); |
|
| 25 | |||
| 26 | 53 | if ($options->get('expose_curl_info')) { |
|
| 27 | 1 | $curlInfo = curl_getinfo($curl); |
|
| 28 | } |
||
| 29 | 53 | } finally { |
|
| 30 | 58 | $this->releaseHandle($curl); |
|
| 31 | } |
||
| 32 | |||
| 33 | 53 | $response = $responseBuilder->getResponse(); |
|
| 34 | 53 | if (null !== $curlInfo && $value = json_encode($curlInfo)) { |
|
| 35 | 1 | $response = $response->withHeader('__curl_info', $value); |
|
| 36 | } |
||
| 37 | |||
| 38 | 53 | return $response; |
|
| 39 | } |
||
| 41 |