1 | <?php |
||||
2 | |||||
3 | namespace Resova\Endpoints\Baskets; |
||||
4 | |||||
5 | use Resova\Client; |
||||
6 | use Resova\Models\PromotionRequest; |
||||
7 | |||||
8 | class Promotions extends Client |
||||
9 | { |
||||
10 | /** |
||||
11 | * Create a basket promotion |
||||
12 | * Creates a new basket promotion object. |
||||
13 | * |
||||
14 | * @param PromotionRequest $promotion |
||||
15 | * |
||||
16 | * @return $this |
||||
17 | */ |
||||
18 | public function create(PromotionRequest $promotion): self |
||||
19 | { |
||||
20 | // Set HTTP params |
||||
21 | $this->type = 'post'; |
||||
22 | $this->endpoint = '/baskets/' . $this->basket_id . '/promotions'; |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() The property
basket_id does not exist on Resova\Endpoints\Baskets\Promotions . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
23 | $this->params = $promotion; |
||||
24 | |||||
25 | return $this; |
||||
26 | } |
||||
27 | |||||
28 | /** |
||||
29 | * Retrieve a basket promotion |
||||
30 | * Retrieves the details of a basket promotion. Provide the unique id for the basket promotion. |
||||
31 | * |
||||
32 | * @param int $promotion_id The basket promotion id |
||||
33 | * |
||||
34 | * @return $this |
||||
35 | */ |
||||
36 | public function __invoke(int $promotion_id): self |
||||
37 | { |
||||
38 | $this->promotion_id = $promotion_id; |
||||
0 ignored issues
–
show
|
|||||
39 | |||||
40 | // Set HTTP params |
||||
41 | $this->type = 'get'; |
||||
42 | $this->endpoint = '/baskets/' . $this->basket_id . '/promotions/' . $promotion_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
![]() The property
basket_id does not exist on Resova\Endpoints\Baskets\Promotions . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
43 | |||||
44 | return $this; |
||||
45 | } |
||||
46 | |||||
47 | /** |
||||
48 | * Delete a basket promotion |
||||
49 | * Permanently deletes a basket promotion. It cannot be undone. |
||||
50 | * |
||||
51 | * @return $this |
||||
52 | */ |
||||
53 | public function delete(): self |
||||
54 | { |
||||
55 | // Set HTTP params |
||||
56 | $this->type = 'delete'; |
||||
57 | $this->endpoint = '/baskets/' . $this->basket_id . '/promotions/' . $this->promotion_id; |
||||
0 ignored issues
–
show
The property
basket_id does not exist on Resova\Endpoints\Baskets\Promotions . Since you implemented __get , consider adding a @property annotation.
![]() 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
![]() |
|||||
58 | |||||
59 | return $this; |
||||
60 | } |
||||
61 | |||||
62 | /** |
||||
63 | * List all basket promotions |
||||
64 | * Returns a list of your basket promotions. |
||||
65 | * The basket promotions are returned sorted by creation date, with the most recent basket purchase appearing first. |
||||
66 | * |
||||
67 | * @return $this |
||||
68 | */ |
||||
69 | public function all(): self |
||||
70 | { |
||||
71 | // Set HTTP params |
||||
72 | $this->type = 'get'; |
||||
73 | $this->endpoint = '/baskets/' . $this->basket_id . '/promotions'; |
||||
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
![]() The property
basket_id does not exist on Resova\Endpoints\Baskets\Promotions . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
74 | |||||
75 | return $this; |
||||
76 | } |
||||
77 | } |
||||
78 |