PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / vendor / square / square / src / Legacy / Models / RetrieveInventoryChangesRequest.php

RetrieveInventoryChangesRequest.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/RetrieveInventoryChangesRequest.php

125 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Models;
6
7 use stdClass;
8
9 class RetrieveInventoryChangesRequest implements \JsonSerializable
10 {
11 /**
12 * @var array
13 */
14 private $locationIds = [];
15
16 /**
17 * @var array
18 */
19 private $cursor = [];
20
21 /**
22 * Returns Location Ids.
23 * The [Location](entity:Location) IDs to look up as a comma-separated
24 * list. An empty list queries all locations.
25 */
26 public function getLocationIds(): ?string
27 {
28 if (count($this->locationIds) == 0) {
29 return null;
30 }
31 return $this->locationIds['value'];
32 }
33
34 /**
35 * Sets Location Ids.
36 * The [Location](entity:Location) IDs to look up as a comma-separated
37 * list. An empty list queries all locations.
38 *
39 * @maps location_ids
40 */
41 public function setLocationIds(?string $locationIds): void
42 {
43 $this->locationIds['value'] = $locationIds;
44 }
45
46 /**
47 * Unsets Location Ids.
48 * The [Location](entity:Location) IDs to look up as a comma-separated
49 * list. An empty list queries all locations.
50 */
51 public function unsetLocationIds(): void
52 {
53 $this->locationIds = [];
54 }
55
56 /**
57 * Returns Cursor.
58 * A pagination cursor returned by a previous call to this endpoint.
59 * Provide this to retrieve the next set of results for the original query.
60 *
61 * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for
62 * more information.
63 */
64 public function getCursor(): ?string
65 {
66 if (count($this->cursor) == 0) {
67 return null;
68 }
69 return $this->cursor['value'];
70 }
71
72 /**
73 * Sets Cursor.
74 * A pagination cursor returned by a previous call to this endpoint.
75 * Provide this to retrieve the next set of results for the original query.
76 *
77 * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for
78 * more information.
79 *
80 * @maps cursor
81 */
82 public function setCursor(?string $cursor): void
83 {
84 $this->cursor['value'] = $cursor;
85 }
86
87 /**
88 * Unsets Cursor.
89 * A pagination cursor returned by a previous call to this endpoint.
90 * Provide this to retrieve the next set of results for the original query.
91 *
92 * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for
93 * more information.
94 */
95 public function unsetCursor(): void
96 {
97 $this->cursor = [];
98 }
99
100 /**
101 * Encode this object to JSON
102 *
103 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
104 * are set. (default: false)
105 *
106 * @return array|stdClass
107 */
108 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
109 public function jsonSerialize(bool $asArrayWhenEmpty = false)
110 {
111 $json = [];
112 if (!empty($this->locationIds)) {
113 $json['location_ids'] = $this->locationIds['value'];
114 }
115 if (!empty($this->cursor)) {
116 $json['cursor'] = $this->cursor['value'];
117 }
118 $json = array_filter($json, function ($val) {
119 return $val !== null;
120 });
121
122 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
123 }
124 }
125