PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / Framework / FieldsAPI / Properties / DonationForm / CurrencySwitcherSetting.php

CurrencySwitcherSetting.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Framework/FieldsAPI/Properties/DonationForm/CurrencySwitcherSetting.php

125 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 namespace Give\Framework\FieldsAPI\Properties\DonationForm;
4
5 use JsonSerializable;
6
7 /**
8 * @since 3.0.0
9 */
10 class CurrencySwitcherSetting implements JsonSerializable
11 {
12 /**
13 * @var string
14 */
15 protected $id;
16 /**
17 * @var float
18 */
19 protected $exchangeRate;
20 /**
21 * @var string[]
22 */
23 protected $gateways = [];
24 /**
25 * @var int
26 */
27 protected $exchangeRateFractionDigits;
28
29 /**
30 * @since 3.0.0
31 */
32 public function __construct(
33 string $id,
34 float $exchangeRate = 0,
35 array $gateways = [],
36 int $exchangeRateFractionDigits = 2
37 ) {
38 $this->id = $id;
39 $this->exchangeRate = $exchangeRate;
40 $this->gateways = $gateways;
41 $this->exchangeRateFractionDigits = $exchangeRateFractionDigits;
42 }
43
44 /**
45 * @since 3.0.0
46 */
47 #[\ReturnTypeWillChange]
48 public function jsonSerialize()
49 {
50 return get_object_vars($this);
51 }
52
53 /**
54 * @since 3.0.0
55 */
56 public function id(string $id): CurrencySwitcherSetting
57 {
58 $this->id = $id;
59
60 return $this;
61 }
62
63 /**
64 * @since 3.0.0
65 */
66 public function getId(): string
67 {
68 return $this->id;
69 }
70
71 /**
72 * @since 3.0.0
73 */
74 public function exchangeRate(float $rate): CurrencySwitcherSetting
75 {
76 $this->exchangeRate = $rate;
77
78 return $this;
79 }
80
81 /**
82 * @since 3.0.0
83 */
84 public function getExchangeRate(): float
85 {
86 return $this->exchangeRate;
87 }
88
89 /**
90 * @since 3.0.0
91 */
92 public function exchangeRateFractionDigits(int $exchangeRateFractionDigits): CurrencySwitcherSetting
93 {
94 $this->exchangeRateFractionDigits = $exchangeRateFractionDigits;
95
96 return $this;
97 }
98
99 /**
100 * @since 3.0.0
101 */
102 public function getExchangeRateFractionDigits(): int
103 {
104 return $this->exchangeRateFractionDigits;
105 }
106
107 /**
108 * @since 3.0.0
109 */
110 public function gateways(array $gateways): CurrencySwitcherSetting
111 {
112 $this->gateways = $gateways;
113
114 return $this;
115 }
116
117 /**
118 * @return array|string[]
119 */
120 public function getGateways(): array
121 {
122 return $this->gateways;
123 }
124 }
125