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

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

74 lines 2.2 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 * Describes when the loyalty program expires.
11 */
12 class LoyaltyProgramExpirationPolicy implements \JsonSerializable
13 {
14 /**
15 * @var string
16 */
17 private $expirationDuration;
18
19 /**
20 * @param string $expirationDuration
21 */
22 public function __construct(string $expirationDuration)
23 {
24 $this->expirationDuration = $expirationDuration;
25 }
26
27 /**
28 * Returns Expiration Duration.
29 * The number of months before points expire, in `P[n]M` RFC 3339 duration format. For example, a value
30 * of `P12M` represents a duration of 12 months.
31 * Points are valid through the last day of the month in which they are scheduled to expire. For
32 * example, with a `P12M` duration, points earned on July 6, 2020 expire on August 1, 2021.
33 */
34 public function getExpirationDuration(): string
35 {
36 return $this->expirationDuration;
37 }
38
39 /**
40 * Sets Expiration Duration.
41 * The number of months before points expire, in `P[n]M` RFC 3339 duration format. For example, a value
42 * of `P12M` represents a duration of 12 months.
43 * Points are valid through the last day of the month in which they are scheduled to expire. For
44 * example, with a `P12M` duration, points earned on July 6, 2020 expire on August 1, 2021.
45 *
46 * @required
47 * @maps expiration_duration
48 */
49 public function setExpirationDuration(string $expirationDuration): void
50 {
51 $this->expirationDuration = $expirationDuration;
52 }
53
54 /**
55 * Encode this object to JSON
56 *
57 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
58 * are set. (default: false)
59 *
60 * @return array|stdClass
61 */
62 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
63 public function jsonSerialize(bool $asArrayWhenEmpty = false)
64 {
65 $json = [];
66 $json['expiration_duration'] = $this->expirationDuration;
67 $json = array_filter($json, function ($val) {
68 return $val !== null;
69 });
70
71 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
72 }
73 }
74