| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 48 | 2 | public function requestAPI(string $endpoint, string $method, string $header, array $queryParams = []): array |
|
| 49 | { |
||
| 50 | $httpData = [ |
||
| 51 | 2 | 'method' => $method, |
|
| 52 | 2 | 'header' => $header, |
|
| 53 | ]; |
||
| 54 | |||
| 55 | 2 | if (!empty($queryParams)) { |
|
| 56 | 1 | $httpData['content'] = http_build_query($queryParams); |
|
| 57 | } |
||
| 58 | |||
| 59 | 2 | $content = \Safe\file_get_contents($this->baseUrl . $endpoint, false, stream_context_create(['http' => $httpData])); |
|
| 60 | |||
| 61 | 2 | return \Safe\json_decode($content, true); |
|
| 62 | 2 | } |
|
| 64 |