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

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

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