Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
12 | 2 | public function getResponse($url, array $data) |
|
13 | { |
||
14 | 2 | $ch = curl_init($url); |
|
15 | 2 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
|
16 | 2 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
17 | |||
18 | 2 | $response = curl_exec($ch); |
|
19 | 2 | $error = curl_error($ch); |
|
20 | 2 | curl_close($ch); |
|
21 | |||
22 | 2 | if (!$response) { |
|
23 | 1 | throw Exception\InvalidResponseException::with($url, $error); |
|
24 | } |
||
25 | |||
26 | 1 | return $response; |
|
27 | } |
||
28 | } |
||
29 |