PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13.1
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13.1
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 / CatalogObjectReference.php

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

115 lines 2.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 * A reference to a Catalog object at a specific version. In general this is
11 * used as an entry point into a graph of catalog objects, where the objects exist
12 * at a specific version.
13 */
14 class CatalogObjectReference implements \JsonSerializable
15 {
16 /**
17 * @var array
18 */
19 private $objectId = [];
20
21 /**
22 * @var array
23 */
24 private $catalogVersion = [];
25
26 /**
27 * Returns Object Id.
28 * The ID of the referenced object.
29 */
30 public function getObjectId(): ?string
31 {
32 if (count($this->objectId) == 0) {
33 return null;
34 }
35 return $this->objectId['value'];
36 }
37
38 /**
39 * Sets Object Id.
40 * The ID of the referenced object.
41 *
42 * @maps object_id
43 */
44 public function setObjectId(?string $objectId): void
45 {
46 $this->objectId['value'] = $objectId;
47 }
48
49 /**
50 * Unsets Object Id.
51 * The ID of the referenced object.
52 */
53 public function unsetObjectId(): void
54 {
55 $this->objectId = [];
56 }
57
58 /**
59 * Returns Catalog Version.
60 * The version of the object.
61 */
62 public function getCatalogVersion(): ?int
63 {
64 if (count($this->catalogVersion) == 0) {
65 return null;
66 }
67 return $this->catalogVersion['value'];
68 }
69
70 /**
71 * Sets Catalog Version.
72 * The version of the object.
73 *
74 * @maps catalog_version
75 */
76 public function setCatalogVersion(?int $catalogVersion): void
77 {
78 $this->catalogVersion['value'] = $catalogVersion;
79 }
80
81 /**
82 * Unsets Catalog Version.
83 * The version of the object.
84 */
85 public function unsetCatalogVersion(): void
86 {
87 $this->catalogVersion = [];
88 }
89
90 /**
91 * Encode this object to JSON
92 *
93 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
94 * are set. (default: false)
95 *
96 * @return array|stdClass
97 */
98 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
99 public function jsonSerialize(bool $asArrayWhenEmpty = false)
100 {
101 $json = [];
102 if (!empty($this->objectId)) {
103 $json['object_id'] = $this->objectId['value'];
104 }
105 if (!empty($this->catalogVersion)) {
106 $json['catalog_version'] = $this->catalogVersion['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