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 / ListCustomerGroupsRequest.php

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

144 lines 4.4 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 /**
10 * Defines the query parameters that can be included in a request to the
11 * [ListCustomerGroups]($e/CustomerGroups/ListCustomerGroups) endpoint.
12 */
13 class ListCustomerGroupsRequest implements \JsonSerializable
14 {
15 /**
16 * @var array
17 */
18 private $cursor = [];
19
20 /**
21 * @var array
22 */
23 private $limit = [];
24
25 /**
26 * Returns Cursor.
27 * A pagination cursor returned by a previous call to this endpoint.
28 * Provide this cursor to retrieve the next set of results for your original query.
29 *
30 * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-
31 * patterns/pagination).
32 */
33 public function getCursor(): ?string
34 {
35 if (count($this->cursor) == 0) {
36 return null;
37 }
38 return $this->cursor['value'];
39 }
40
41 /**
42 * Sets Cursor.
43 * A pagination cursor returned by a previous call to this endpoint.
44 * Provide this cursor to retrieve the next set of results for your original query.
45 *
46 * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-
47 * patterns/pagination).
48 *
49 * @maps cursor
50 */
51 public function setCursor(?string $cursor): void
52 {
53 $this->cursor['value'] = $cursor;
54 }
55
56 /**
57 * Unsets Cursor.
58 * A pagination cursor returned by a previous call to this endpoint.
59 * Provide this cursor to retrieve the next set of results for your original query.
60 *
61 * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-
62 * patterns/pagination).
63 */
64 public function unsetCursor(): void
65 {
66 $this->cursor = [];
67 }
68
69 /**
70 * Returns Limit.
71 * The maximum number of results to return in a single page. This limit is advisory. The response might
72 * contain more or fewer results.
73 * If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400
74 * VALUE_TOO_HIGH` error. The default value is 50.
75 *
76 * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-
77 * patterns/pagination).
78 */
79 public function getLimit(): ?int
80 {
81 if (count($this->limit) == 0) {
82 return null;
83 }
84 return $this->limit['value'];
85 }
86
87 /**
88 * Sets Limit.
89 * The maximum number of results to return in a single page. This limit is advisory. The response might
90 * contain more or fewer results.
91 * If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400
92 * VALUE_TOO_HIGH` error. The default value is 50.
93 *
94 * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-
95 * patterns/pagination).
96 *
97 * @maps limit
98 */
99 public function setLimit(?int $limit): void
100 {
101 $this->limit['value'] = $limit;
102 }
103
104 /**
105 * Unsets Limit.
106 * The maximum number of results to return in a single page. This limit is advisory. The response might
107 * contain more or fewer results.
108 * If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400
109 * VALUE_TOO_HIGH` error. The default value is 50.
110 *
111 * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-
112 * patterns/pagination).
113 */
114 public function unsetLimit(): void
115 {
116 $this->limit = [];
117 }
118
119 /**
120 * Encode this object to JSON
121 *
122 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
123 * are set. (default: false)
124 *
125 * @return array|stdClass
126 */
127 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
128 public function jsonSerialize(bool $asArrayWhenEmpty = false)
129 {
130 $json = [];
131 if (!empty($this->cursor)) {
132 $json['cursor'] = $this->cursor['value'];
133 }
134 if (!empty($this->limit)) {
135 $json['limit'] = $this->limit['value'];
136 }
137 $json = array_filter($json, function ($val) {
138 return $val !== null;
139 });
140
141 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
142 }
143 }
144