| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 30 | public function query(array $query=[], string $path=''): Result { |
||
| 31 | $url = $this->baseUrl . $path; |
||
| 32 | |||
| 33 | if (count($query)) { |
||
| 34 | $url .= '?' . http_build_query($query); |
||
| 35 | } |
||
| 36 | |||
| 37 | $request = $this->requestFactory->createRequest('GET', $url, []); |
||
| 38 | $response = $this->httpClient->sendRequest($request); |
||
| 39 | |||
| 40 | # TOOD: detect and throw error |
||
| 41 | |||
| 42 | $data = json_decode((string)$response->getBody(),true); |
||
| 43 | |||
| 44 | # TODO: add total, offset, limit of page |
||
| 45 | return new Result($data ?? []); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |