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.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 1.7.0.9 All 211 releases
charitable / vendor / square / square / src / Legacy / Models / SelectOption.php

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

94 lines 2.0 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 class SelectOption implements \JsonSerializable
10 {
11 /**
12 * @var string
13 */
14 private $referenceId;
15
16 /**
17 * @var string
18 */
19 private $title;
20
21 /**
22 * @param string $referenceId
23 * @param string $title
24 */
25 public function __construct(string $referenceId, string $title)
26 {
27 $this->referenceId = $referenceId;
28 $this->title = $title;
29 }
30
31 /**
32 * Returns Reference Id.
33 * The reference id for the option.
34 */
35 public function getReferenceId(): string
36 {
37 return $this->referenceId;
38 }
39
40 /**
41 * Sets Reference Id.
42 * The reference id for the option.
43 *
44 * @required
45 * @maps reference_id
46 */
47 public function setReferenceId(string $referenceId): void
48 {
49 $this->referenceId = $referenceId;
50 }
51
52 /**
53 * Returns Title.
54 * The title text that displays in the select option button.
55 */
56 public function getTitle(): string
57 {
58 return $this->title;
59 }
60
61 /**
62 * Sets Title.
63 * The title text that displays in the select option button.
64 *
65 * @required
66 * @maps title
67 */
68 public function setTitle(string $title): void
69 {
70 $this->title = $title;
71 }
72
73 /**
74 * Encode this object to JSON
75 *
76 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
77 * are set. (default: false)
78 *
79 * @return array|stdClass
80 */
81 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
82 public function jsonSerialize(bool $asArrayWhenEmpty = false)
83 {
84 $json = [];
85 $json['reference_id'] = $this->referenceId;
86 $json['title'] = $this->title;
87 $json = array_filter($json, function ($val) {
88 return $val !== null;
89 });
90
91 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
92 }
93 }
94