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.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 1.7.0.9 All 211 releases
charitable / vendor / square / square / src / Legacy / Models / UpdateBookingCustomAttributeDefinitionRequest.php

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

115 lines 3.6 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 * Represents an
11 * [UpdateBookingCustomAttributeDefinition]($e/BookingCustomAttributes/UpdateBookingCustomAttributeDefi
12 * nition) request.
13 */
14 class UpdateBookingCustomAttributeDefinitionRequest implements \JsonSerializable
15 {
16 /**
17 * @var CustomAttributeDefinition
18 */
19 private $customAttributeDefinition;
20
21 /**
22 * @var array
23 */
24 private $idempotencyKey = [];
25
26 /**
27 * @param CustomAttributeDefinition $customAttributeDefinition
28 */
29 public function __construct(CustomAttributeDefinition $customAttributeDefinition)
30 {
31 $this->customAttributeDefinition = $customAttributeDefinition;
32 }
33
34 /**
35 * Returns Custom Attribute Definition.
36 * Represents a definition for custom attribute values. A custom attribute definition
37 * specifies the key, visibility, schema, and other properties for a custom attribute.
38 */
39 public function getCustomAttributeDefinition(): CustomAttributeDefinition
40 {
41 return $this->customAttributeDefinition;
42 }
43
44 /**
45 * Sets Custom Attribute Definition.
46 * Represents a definition for custom attribute values. A custom attribute definition
47 * specifies the key, visibility, schema, and other properties for a custom attribute.
48 *
49 * @required
50 * @maps custom_attribute_definition
51 */
52 public function setCustomAttributeDefinition(CustomAttributeDefinition $customAttributeDefinition): void
53 {
54 $this->customAttributeDefinition = $customAttributeDefinition;
55 }
56
57 /**
58 * Returns Idempotency Key.
59 * A unique identifier for this request, used to ensure idempotency. For more information,
60 * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
61 */
62 public function getIdempotencyKey(): ?string
63 {
64 if (count($this->idempotencyKey) == 0) {
65 return null;
66 }
67 return $this->idempotencyKey['value'];
68 }
69
70 /**
71 * Sets Idempotency Key.
72 * A unique identifier for this request, used to ensure idempotency. For more information,
73 * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
74 *
75 * @maps idempotency_key
76 */
77 public function setIdempotencyKey(?string $idempotencyKey): void
78 {
79 $this->idempotencyKey['value'] = $idempotencyKey;
80 }
81
82 /**
83 * Unsets Idempotency Key.
84 * A unique identifier for this request, used to ensure idempotency. For more information,
85 * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
86 */
87 public function unsetIdempotencyKey(): void
88 {
89 $this->idempotencyKey = [];
90 }
91
92 /**
93 * Encode this object to JSON
94 *
95 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
96 * are set. (default: false)
97 *
98 * @return array|stdClass
99 */
100 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
101 public function jsonSerialize(bool $asArrayWhenEmpty = false)
102 {
103 $json = [];
104 $json['custom_attribute_definition'] = $this->customAttributeDefinition;
105 if (!empty($this->idempotencyKey)) {
106 $json['idempotency_key'] = $this->idempotencyKey['value'];
107 }
108 $json = array_filter($json, function ($val) {
109 return $val !== null;
110 });
111
112 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
113 }
114 }
115