| Conditions | 2 |
| Paths | 2 |
| Total Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 1 | public function send(Request $request, $timeout = null) |
|
| 32 | { |
||
| 33 | $options = [ |
||
| 34 | 1 | 'auth' => $request->getAuth(), |
|
| 35 | 1 | 'headers' => $request->getHeaders(), |
|
| 36 | 'http_errors' => false, |
||
| 37 | 1 | 'timeout' => $timeout, |
|
| 38 | 1 | 'connect_timeout' => 10, |
|
| 39 | 1 | RequestOptions::JSON => $request->json(), |
|
| 40 | ]; |
||
| 41 | try { |
||
| 42 | 1 | $response = $this->guzzleClient->request( |
|
| 43 | 1 | $request->getMethod(), |
|
| 44 | 1 | $request->getUrl(), |
|
| 45 | $options |
||
| 46 | ); |
||
| 47 | 1 | } catch (RequestException $e) { |
|
| 48 | 1 | throw new PostpayException($e->getMessage(), $e->getCode()); |
|
| 49 | } |
||
| 50 | 1 | return new Response( |
|
| 51 | 1 | $request, |
|
| 52 | 1 | $response->getStatusCode(), |
|
| 53 | 1 | $response->getHeaders(), |
|
| 54 | 1 | $response->getBody() |
|
| 55 | ); |
||
| 56 | } |
||
| 57 | } |
||
| 58 |