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

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

247 lines 6.2 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 * An enumerated value that can link a
11 * `CatalogItemVariation` to an item option as one of
12 * its item option values.
13 */
14 class CatalogItemOptionValue implements \JsonSerializable
15 {
16 /**
17 * @var array
18 */
19 private $itemOptionId = [];
20
21 /**
22 * @var array
23 */
24 private $name = [];
25
26 /**
27 * @var array
28 */
29 private $description = [];
30
31 /**
32 * @var array
33 */
34 private $color = [];
35
36 /**
37 * @var array
38 */
39 private $ordinal = [];
40
41 /**
42 * Returns Item Option Id.
43 * Unique ID of the associated item option.
44 */
45 public function getItemOptionId(): ?string
46 {
47 if (count($this->itemOptionId) == 0) {
48 return null;
49 }
50 return $this->itemOptionId['value'];
51 }
52
53 /**
54 * Sets Item Option Id.
55 * Unique ID of the associated item option.
56 *
57 * @maps item_option_id
58 */
59 public function setItemOptionId(?string $itemOptionId): void
60 {
61 $this->itemOptionId['value'] = $itemOptionId;
62 }
63
64 /**
65 * Unsets Item Option Id.
66 * Unique ID of the associated item option.
67 */
68 public function unsetItemOptionId(): void
69 {
70 $this->itemOptionId = [];
71 }
72
73 /**
74 * Returns Name.
75 * Name of this item option value. This is a searchable attribute for use in applicable query filters.
76 */
77 public function getName(): ?string
78 {
79 if (count($this->name) == 0) {
80 return null;
81 }
82 return $this->name['value'];
83 }
84
85 /**
86 * Sets Name.
87 * Name of this item option value. This is a searchable attribute for use in applicable query filters.
88 *
89 * @maps name
90 */
91 public function setName(?string $name): void
92 {
93 $this->name['value'] = $name;
94 }
95
96 /**
97 * Unsets Name.
98 * Name of this item option value. This is a searchable attribute for use in applicable query filters.
99 */
100 public function unsetName(): void
101 {
102 $this->name = [];
103 }
104
105 /**
106 * Returns Description.
107 * A human-readable description for the option value. This is a searchable attribute for use in
108 * applicable query filters.
109 */
110 public function getDescription(): ?string
111 {
112 if (count($this->description) == 0) {
113 return null;
114 }
115 return $this->description['value'];
116 }
117
118 /**
119 * Sets Description.
120 * A human-readable description for the option value. This is a searchable attribute for use in
121 * applicable query filters.
122 *
123 * @maps description
124 */
125 public function setDescription(?string $description): void
126 {
127 $this->description['value'] = $description;
128 }
129
130 /**
131 * Unsets Description.
132 * A human-readable description for the option value. This is a searchable attribute for use in
133 * applicable query filters.
134 */
135 public function unsetDescription(): void
136 {
137 $this->description = [];
138 }
139
140 /**
141 * Returns Color.
142 * The HTML-supported hex color for the item option (e.g., "#ff8d4e85").
143 * Only displayed if `show_colors` is enabled on the parent `ItemOption`. When
144 * left unset, `color` defaults to white ("#ffffff") when `show_colors` is
145 * enabled on the parent `ItemOption`.
146 */
147 public function getColor(): ?string
148 {
149 if (count($this->color) == 0) {
150 return null;
151 }
152 return $this->color['value'];
153 }
154
155 /**
156 * Sets Color.
157 * The HTML-supported hex color for the item option (e.g., "#ff8d4e85").
158 * Only displayed if `show_colors` is enabled on the parent `ItemOption`. When
159 * left unset, `color` defaults to white ("#ffffff") when `show_colors` is
160 * enabled on the parent `ItemOption`.
161 *
162 * @maps color
163 */
164 public function setColor(?string $color): void
165 {
166 $this->color['value'] = $color;
167 }
168
169 /**
170 * Unsets Color.
171 * The HTML-supported hex color for the item option (e.g., "#ff8d4e85").
172 * Only displayed if `show_colors` is enabled on the parent `ItemOption`. When
173 * left unset, `color` defaults to white ("#ffffff") when `show_colors` is
174 * enabled on the parent `ItemOption`.
175 */
176 public function unsetColor(): void
177 {
178 $this->color = [];
179 }
180
181 /**
182 * Returns Ordinal.
183 * Determines where this option value appears in a list of option values.
184 */
185 public function getOrdinal(): ?int
186 {
187 if (count($this->ordinal) == 0) {
188 return null;
189 }
190 return $this->ordinal['value'];
191 }
192
193 /**
194 * Sets Ordinal.
195 * Determines where this option value appears in a list of option values.
196 *
197 * @maps ordinal
198 */
199 public function setOrdinal(?int $ordinal): void
200 {
201 $this->ordinal['value'] = $ordinal;
202 }
203
204 /**
205 * Unsets Ordinal.
206 * Determines where this option value appears in a list of option values.
207 */
208 public function unsetOrdinal(): void
209 {
210 $this->ordinal = [];
211 }
212
213 /**
214 * Encode this object to JSON
215 *
216 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
217 * are set. (default: false)
218 *
219 * @return array|stdClass
220 */
221 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
222 public function jsonSerialize(bool $asArrayWhenEmpty = false)
223 {
224 $json = [];
225 if (!empty($this->itemOptionId)) {
226 $json['item_option_id'] = $this->itemOptionId['value'];
227 }
228 if (!empty($this->name)) {
229 $json['name'] = $this->name['value'];
230 }
231 if (!empty($this->description)) {
232 $json['description'] = $this->description['value'];
233 }
234 if (!empty($this->color)) {
235 $json['color'] = $this->color['value'];
236 }
237 if (!empty($this->ordinal)) {
238 $json['ordinal'] = $this->ordinal['value'];
239 }
240 $json = array_filter($json, function ($val) {
241 return $val !== null;
242 });
243
244 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
245 }
246 }
247