| Conditions | 2 |
| Paths | 1 |
| Total Lines | 29 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public function getWithSignature($url, $signature) |
||
| 24 | { |
||
| 25 | curl_setopt($this->curlHandle, CURLOPT_URL, $url); |
||
| 26 | curl_setopt( |
||
| 27 | $this->curlHandle, |
||
| 28 | CURLOPT_HTTPHEADER, |
||
| 29 | [ |
||
| 30 | 'Authorization: ' . $signature, |
||
| 31 | ] |
||
| 32 | ); |
||
| 33 | curl_setopt($this->curlHandle, CURLOPT_RETURNTRANSFER, true); |
||
| 34 | $headers = []; |
||
| 35 | curl_setopt( |
||
| 36 | $this->curlHandle, |
||
| 37 | CURLOPT_HEADERFUNCTION, |
||
| 38 | function ($curl, $header) use (&$headers) { |
||
| 39 | if (strpos($header, ':') !== false) { |
||
| 40 | list($key, $value) = explode(':', $header, 2); |
||
| 41 | $headers[$key] = trim($value); |
||
| 42 | } |
||
| 43 | |||
| 44 | return strlen($header); |
||
| 45 | } |
||
| 46 | ); |
||
| 47 | |||
| 48 | $body = curl_exec($this->curlHandle); |
||
| 49 | $statusCode = curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE); |
||
| 50 | |||
| 51 | return new Response($statusCode, $headers, $body); |
||
| 52 | } |
||
| 54 |