| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2.0054 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | 1 | public function __invoke(string $start_date, string $end_date, array $item_ids = []): self |
|
| 20 | { |
||
| 21 | // Default parameters |
||
| 22 | $params = [ |
||
| 23 | 1 | 'start_date' => $start_date, |
|
| 24 | 1 | 'end_date' => $end_date, |
|
| 25 | ]; |
||
| 26 | |||
| 27 | // Optional: Limit the availability results by item ids |
||
| 28 | 1 | if (!empty($item_ids)) { |
|
| 29 | $params['item_ids'] = implode(',', $item_ids); |
||
| 30 | } |
||
| 31 | |||
| 32 | // Set HTTP params |
||
| 33 | 1 | $this->type = 'get'; |
|
| 34 | 1 | $this->endpoint = '/availability/calendar' . '?' . http_build_query($params); |
|
| 35 | 1 | $this->response = \Resova\Models\Availability::class; |
|
|
|
|||
| 36 | |||
| 37 | 1 | return $this; |
|
| 38 | } |
||
| 41 |