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

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

97 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 * Provides metadata when the event `type` is `EXPIRE_POINTS`.
11 */
12 class LoyaltyEventExpirePoints implements \JsonSerializable
13 {
14 /**
15 * @var string
16 */
17 private $loyaltyProgramId;
18
19 /**
20 * @var int
21 */
22 private $points;
23
24 /**
25 * @param string $loyaltyProgramId
26 * @param int $points
27 */
28 public function __construct(string $loyaltyProgramId, int $points)
29 {
30 $this->loyaltyProgramId = $loyaltyProgramId;
31 $this->points = $points;
32 }
33
34 /**
35 * Returns Loyalty Program Id.
36 * The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
37 */
38 public function getLoyaltyProgramId(): string
39 {
40 return $this->loyaltyProgramId;
41 }
42
43 /**
44 * Sets Loyalty Program Id.
45 * The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
46 *
47 * @required
48 * @maps loyalty_program_id
49 */
50 public function setLoyaltyProgramId(string $loyaltyProgramId): void
51 {
52 $this->loyaltyProgramId = $loyaltyProgramId;
53 }
54
55 /**
56 * Returns Points.
57 * The number of points expired.
58 */
59 public function getPoints(): int
60 {
61 return $this->points;
62 }
63
64 /**
65 * Sets Points.
66 * The number of points expired.
67 *
68 * @required
69 * @maps points
70 */
71 public function setPoints(int $points): void
72 {
73 $this->points = $points;
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 $json['loyalty_program_id'] = $this->loyaltyProgramId;
89 $json['points'] = $this->points;
90 $json = array_filter($json, function ($val) {
91 return $val !== null;
92 });
93
94 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
95 }
96 }
97