| Conditions | 5 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 3 | public function get(int $year, int $month) |
|
| 22 | { |
||
| 23 | 3 | if ($year < 2015 || $year > Carbon::now()->year || $month < 1 || $month > 12) { |
|
| 24 | 2 | throw new UnexpectedValueException('Invalid year or month'); |
|
| 25 | } |
||
| 26 | |||
| 27 | // make the URL for this request |
||
| 28 | 1 | $url = sprintf('%s/%s/%s', $this->getBaseUrl(), $year, $month); |
|
| 29 | |||
| 30 | // get the headers for this request |
||
| 31 | 1 | $headers = $this->headers->make('GET', $url); |
|
| 32 | |||
| 33 | // get the response |
||
| 34 | 1 | $response = $this->client->get($url, [ |
|
| 35 | 1 | 'headers' => $headers, |
|
| 36 | ]); |
||
| 37 | |||
| 38 | // return the response |
||
| 39 | 1 | return $response; |
|
| 40 | } |
||
| 41 | } |
||
| 42 |