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

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

101 lines 2.1 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 * Provides information about the subscription event.
11 */
12 class SubscriptionEventInfo implements \JsonSerializable
13 {
14 /**
15 * @var array
16 */
17 private $detail = [];
18
19 /**
20 * @var string|null
21 */
22 private $code;
23
24 /**
25 * Returns Detail.
26 * A human-readable explanation for the event.
27 */
28 public function getDetail(): ?string
29 {
30 if (count($this->detail) == 0) {
31 return null;
32 }
33 return $this->detail['value'];
34 }
35
36 /**
37 * Sets Detail.
38 * A human-readable explanation for the event.
39 *
40 * @maps detail
41 */
42 public function setDetail(?string $detail): void
43 {
44 $this->detail['value'] = $detail;
45 }
46
47 /**
48 * Unsets Detail.
49 * A human-readable explanation for the event.
50 */
51 public function unsetDetail(): void
52 {
53 $this->detail = [];
54 }
55
56 /**
57 * Returns Code.
58 * Supported info codes of a subscription event.
59 */
60 public function getCode(): ?string
61 {
62 return $this->code;
63 }
64
65 /**
66 * Sets Code.
67 * Supported info codes of a subscription event.
68 *
69 * @maps code
70 */
71 public function setCode(?string $code): void
72 {
73 $this->code = $code;
74 }
75
76 /**
77 * Encode this object to JSON
78 *
79 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
80 * are set. (default: false)
81 *
82 * @return array|stdClass
83 */
84 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
85 public function jsonSerialize(bool $asArrayWhenEmpty = false)
86 {
87 $json = [];
88 if (!empty($this->detail)) {
89 $json['detail'] = $this->detail['value'];
90 }
91 if (isset($this->code)) {
92 $json['code'] = $this->code;
93 }
94 $json = array_filter($json, function ($val) {
95 return $val !== null;
96 });
97
98 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
99 }
100 }
101