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 / Concerns / ShowInReceipt.php

ShowInReceipt.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Framework/FieldsAPI/Concerns/ShowInReceipt.php

106 lines 1.7 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\Concerns;
4
5 use Closure;
6
7 /**
8 * @since 2.10.2
9 */
10 trait ShowInReceipt
11 {
12
13 /**
14 * @since 2.10.2
15 */
16 protected $showInReceipt = false;
17
18 /**
19 * @var string
20 */
21 protected $receiptLabel;
22
23 /**
24 * @var Closure
25 */
26 protected $receiptValueCallback;
27
28 /**
29 * @since 2.10.2
30 */
31 public function showInReceipt($showInReceipt = true): self
32 {
33 $this->showInReceipt = $showInReceipt;
34
35 return $this;
36 }
37
38 /**
39 * @since 2.10.2
40 */
41 public function shouldShowInReceipt(): bool
42 {
43 return $this->showInReceipt;
44 }
45
46 /**
47 * @since 3.3.0
48 */
49 public function receiptLabel(string $label): self
50 {
51 $this->receiptLabel = $label;
52
53 return $this;
54 }
55
56 /**
57 * @since 3.3.0
58 */
59 public function hasReceiptLabel(): bool
60 {
61 return !empty($this->receiptLabel);
62 }
63
64 /**
65 * @since 3.3.0
66 */
67 public function getReceiptLabel(): string
68 {
69 return $this->receiptLabel;
70 }
71
72 /**
73 * @since 3.3.0
74 */
75 public function hasReceiptValue(): bool
76 {
77 return !empty($this->receiptValueCallback);
78 }
79
80 /**
81 * @since 3.3.0
82 */
83 public function isReceiptValueCallback(): bool
84 {
85 return is_callable($this->receiptValueCallback);
86 }
87
88 /**
89 * @since 3.3.0
90 */
91 public function getReceiptValue(): Closure
92 {
93 return $this->receiptValueCallback;
94 }
95
96 /**
97 * @since 3.3.0
98 */
99 public function receiptValue(Closure $value): self
100 {
101 $this->receiptValueCallback = $value;
102
103 return $this;
104 }
105 }
106