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

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

120 lines 3.9 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 a
11 * [RetrieveBookingCustomAttribute]($e/BookingCustomAttributes/RetrieveBookingCustomAttribute) request.
12 */
13 class RetrieveBookingCustomAttributeRequest implements \JsonSerializable
14 {
15 /**
16 * @var array
17 */
18 private $withDefinition = [];
19
20 /**
21 * @var int|null
22 */
23 private $version;
24
25 /**
26 * Returns With Definition.
27 * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in
28 * the `definition` field of
29 * the custom attribute. Set this parameter to `true` to get the name and description of the custom
30 * attribute, information about the data type, or other definition details. The default value is
31 * `false`.
32 */
33 public function getWithDefinition(): ?bool
34 {
35 if (count($this->withDefinition) == 0) {
36 return null;
37 }
38 return $this->withDefinition['value'];
39 }
40
41 /**
42 * Sets With Definition.
43 * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in
44 * the `definition` field of
45 * the custom attribute. Set this parameter to `true` to get the name and description of the custom
46 * attribute, information about the data type, or other definition details. The default value is
47 * `false`.
48 *
49 * @maps with_definition
50 */
51 public function setWithDefinition(?bool $withDefinition): void
52 {
53 $this->withDefinition['value'] = $withDefinition;
54 }
55
56 /**
57 * Unsets With Definition.
58 * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in
59 * the `definition` field of
60 * the custom attribute. Set this parameter to `true` to get the name and description of the custom
61 * attribute, information about the data type, or other definition details. The default value is
62 * `false`.
63 */
64 public function unsetWithDefinition(): void
65 {
66 $this->withDefinition = [];
67 }
68
69 /**
70 * Returns Version.
71 * The current version of the custom attribute, which is used for strongly consistent reads to
72 * guarantee that you receive the most up-to-date data. When included in the request, Square
73 * returns the specified version or a higher version if one exists. If the specified version is
74 * higher than the current version, Square returns a `BAD_REQUEST` error.
75 */
76 public function getVersion(): ?int
77 {
78 return $this->version;
79 }
80
81 /**
82 * Sets Version.
83 * The current version of the custom attribute, which is used for strongly consistent reads to
84 * guarantee that you receive the most up-to-date data. When included in the request, Square
85 * returns the specified version or a higher version if one exists. If the specified version is
86 * higher than the current version, Square returns a `BAD_REQUEST` error.
87 *
88 * @maps version
89 */
90 public function setVersion(?int $version): void
91 {
92 $this->version = $version;
93 }
94
95 /**
96 * Encode this object to JSON
97 *
98 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
99 * are set. (default: false)
100 *
101 * @return array|stdClass
102 */
103 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
104 public function jsonSerialize(bool $asArrayWhenEmpty = false)
105 {
106 $json = [];
107 if (!empty($this->withDefinition)) {
108 $json['with_definition'] = $this->withDefinition['value'];
109 }
110 if (isset($this->version)) {
111 $json['version'] = $this->version;
112 }
113 $json = array_filter($json, function ($val) {
114 return $val !== null;
115 });
116
117 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
118 }
119 }
120