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 / Receipts / DonationReceipt.php

DonationReceipt.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Framework/Receipts/DonationReceipt.php

80 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 namespace Give\Framework\Receipts;
4
5 use Give\Donations\Models\Donation;
6 use Give\Framework\Receipts\Properties\ReceiptDetailCollection;
7 use Give\Framework\Receipts\Properties\ReceiptSettings;
8 use Give\Framework\Support\Contracts\Arrayable;
9 use Give\Framework\Support\Contracts\Jsonable;
10
11 class DonationReceipt implements Arrayable, Jsonable
12 {
13 /**
14 * @var Donation
15 */
16 public $donation;
17 /**
18 * @var ReceiptSettings
19 */
20 public $settings;
21 /**
22 * @var ReceiptDetailCollection
23 */
24 public $donorDetails;
25 /**
26 * @var ReceiptDetailCollection
27 */
28 public $donationDetails;
29 /**
30 * @var ReceiptDetailCollection
31 */
32 public $additionalDetails;
33 /**
34 * @var ReceiptDetailCollection
35 */
36 public $subscriptionDetails;
37 /**
38 * @var ReceiptDetailCollection
39 */
40 public $eventTicketsDetails;
41
42 /**
43 * @since 3.0.0
44 */
45 public function __construct(Donation $donation)
46 {
47 $this->donation = $donation;
48 $this->settings = new ReceiptSettings();
49 $this->donorDetails = new ReceiptDetailCollection();
50 $this->donationDetails = new ReceiptDetailCollection();
51 $this->eventTicketsDetails = new ReceiptDetailCollection();
52 $this->subscriptionDetails = new ReceiptDetailCollection();
53 $this->additionalDetails = new ReceiptDetailCollection();
54 }
55
56
57 /**
58 * @since 3.0.0
59 */
60 public function toArray(): array
61 {
62 return [
63 'settings' => $this->settings->toArray(),
64 'donorDetails' => $this->donorDetails->toArray(),
65 'donationDetails' => $this->donationDetails->toArray(),
66 'eventTicketsDetails' => $this->eventTicketsDetails->toArray(),
67 'subscriptionDetails' => $this->subscriptionDetails->toArray(),
68 'additionalDetails' => $this->additionalDetails->toArray(),
69 ];
70 }
71
72 /**
73 * @since 3.0.0
74 */
75 public function toJson($options = 0): string
76 {
77 return json_encode($this->toArray(), $options);
78 }
79 }
80