EvilFreelancer /
resova-api-php
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Resova\Endpoints\Baskets; |
||||
| 4 | |||||
| 5 | use Resova\Client; |
||||
| 6 | use Resova\Models\BookingRequest; |
||||
| 7 | |||||
| 8 | class Bookings extends Client |
||||
| 9 | { |
||||
| 10 | /** |
||||
| 11 | * Create a basket |
||||
| 12 | * Creates a new basket object. |
||||
| 13 | * |
||||
| 14 | * @param BookingRequest $booking |
||||
| 15 | * |
||||
| 16 | * @return $this |
||||
| 17 | */ |
||||
| 18 | public function create(BookingRequest $booking): self |
||||
| 19 | { |
||||
| 20 | $booking->setRequired([ |
||||
| 21 | 'instance_id', |
||||
| 22 | 'quantities' |
||||
| 23 | ]); |
||||
| 24 | |||||
| 25 | // Set HTTP params |
||||
| 26 | $this->type = 'post'; |
||||
| 27 | $this->endpoint = '/baskets/' . $this->basket_id . '/bookings'; |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
The property
basket_id does not exist on Resova\Endpoints\Baskets\Bookings. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 28 | $this->params = $booking; |
||||
| 29 | |||||
| 30 | return $this; |
||||
| 31 | } |
||||
| 32 | |||||
| 33 | /** |
||||
| 34 | * Retrieve a basket booking |
||||
| 35 | * Retrieves the details of a basket booking. Provide the unique id for the basket booking. |
||||
| 36 | * |
||||
| 37 | * @param int $booking_id The basket booking id |
||||
| 38 | * |
||||
| 39 | * @return $this |
||||
| 40 | */ |
||||
| 41 | public function __invoke(int $booking_id): self |
||||
| 42 | { |
||||
| 43 | $this->booking_id = $booking_id; |
||||
|
0 ignored issues
–
show
|
|||||
| 44 | |||||
| 45 | // Set HTTP params |
||||
| 46 | $this->type = 'get'; |
||||
| 47 | $this->endpoint = '/baskets/' . $this->basket_id . '/bookings/' . $booking_id; |
||||
|
0 ignored issues
–
show
Are you sure
$this->basket_id of type boolean|object can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The property
basket_id does not exist on Resova\Endpoints\Baskets\Bookings. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 48 | |||||
| 49 | return $this; |
||||
| 50 | } |
||||
| 51 | |||||
| 52 | /** |
||||
| 53 | * Delete a basket booking |
||||
| 54 | * Permanently deletes a basket booking. It cannot be undone. |
||||
| 55 | * |
||||
| 56 | * @return $this |
||||
| 57 | */ |
||||
| 58 | public function delete(): self |
||||
| 59 | { |
||||
| 60 | // Set HTTP params |
||||
| 61 | $this->type = 'delete'; |
||||
| 62 | $this->endpoint = '/baskets/' . $this->basket_id . '/bookings/' . $this->booking_id; |
||||
|
0 ignored issues
–
show
The property
basket_id does not exist on Resova\Endpoints\Baskets\Bookings. Since you implemented __get, consider adding a @property annotation.
Loading history...
Are you sure
$this->basket_id of type boolean|object can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 63 | |||||
| 64 | return $this; |
||||
| 65 | } |
||||
| 66 | |||||
| 67 | /** |
||||
| 68 | * Update a basket booking |
||||
| 69 | * Updates the specified basket booking by setting the values of the parameters passed. |
||||
| 70 | * Any parameters not provided will be left unchanged. |
||||
| 71 | * This request accepts mostly the same arguments as the basket booking creation call. |
||||
| 72 | * |
||||
| 73 | * @param null|BookingRequest $booking |
||||
| 74 | * |
||||
| 75 | * @return $this |
||||
| 76 | */ |
||||
| 77 | public function update(BookingRequest $booking = null): self |
||||
| 78 | { |
||||
| 79 | // Set HTTP params |
||||
| 80 | $this->type = 'put'; |
||||
| 81 | $this->endpoint = '/baskets/' . $this->basket_id . '/bookings'; |
||||
|
0 ignored issues
–
show
Are you sure
$this->basket_id of type boolean|object can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The property
basket_id does not exist on Resova\Endpoints\Baskets\Bookings. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 82 | $this->params = $booking; |
||||
| 83 | |||||
| 84 | return $this; |
||||
| 85 | } |
||||
| 86 | |||||
| 87 | /** |
||||
| 88 | * List basket bookings |
||||
| 89 | * Returns a list of your basket bookings. |
||||
| 90 | * The basket bookings are returned sorted by creation date, with the most recent basket booking appearing first. |
||||
| 91 | * |
||||
| 92 | * @return $this |
||||
| 93 | */ |
||||
| 94 | public function all(): self |
||||
| 95 | { |
||||
| 96 | // Set HTTP params |
||||
| 97 | $this->type = 'get'; |
||||
| 98 | $this->endpoint = '/baskets/' . $this->basket_id . '/bookings'; |
||||
|
0 ignored issues
–
show
The property
basket_id does not exist on Resova\Endpoints\Baskets\Bookings. Since you implemented __get, consider adding a @property annotation.
Loading history...
Are you sure
$this->basket_id of type boolean|object can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 99 | |||||
| 100 | return $this; |
||||
| 101 | } |
||||
| 102 | } |
||||
| 103 |