| Conditions | 3 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 3 | public function get(Endpoint $endpoint): string |
|
| 27 | { |
||
| 28 | 3 | $uri = new Uri( |
|
| 29 | 3 | $this->alphaVantageApiUrl . $endpoint->getQueryString() . '&apikey=' . $this->alphaVantageApiKey |
|
| 30 | ); |
||
| 31 | |||
| 32 | try { |
||
| 33 | 3 | $response = $this->client->request('GET', $uri); |
|
| 34 | 2 | if ($response->getStatusCode() === 200) { |
|
| 35 | 1 | return $response->getBody()->getContents(); |
|
| 36 | } |
||
| 37 | 1 | throw new Exception('Invalid statuscode returned: ' . $response->getStatusCode()); |
|
| 38 | 2 | } catch (GuzzleException $exception) { |
|
| 39 | 1 | throw new Exception('Invalid request made: ' . $exception->getMessage()); |
|
| 40 | } |
||
| 43 |