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 / Properties / ReceiptDetailCollection.php

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

67 lines 1.3 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\Properties;
4
5 use Give\Framework\Support\Contracts\Arrayable;
6
7 use function array_map;
8 use function array_merge;
9
10 class ReceiptDetailCollection implements Arrayable
11 {
12 /**
13 * @var ReceiptDetail[]
14 */
15 protected $receiptDetails;
16
17 /**
18 * @since 3.0.0
19 *
20 * @param ReceiptDetail[] $receiptDetails
21 */
22 public function __construct(array $receiptDetails = [])
23 {
24 $this->receiptDetails = $receiptDetails;
25 }
26
27 /**
28 * @since 3.0.0
29 *
30 * @param ReceiptDetail $receiptDetail
31 * @return void
32 */
33 public function addDetail(ReceiptDetail $receiptDetail)
34 {
35 $this->receiptDetails[] = $receiptDetail;
36 }
37
38 /**
39 * @since 3.0.0
40 *
41 * @param ReceiptDetail[] $receiptDetails
42 * @return void
43 */
44 public function addDetails(array $receiptDetails)
45 {
46 $this->receiptDetails = array_merge($this->receiptDetails, $receiptDetails);
47 }
48
49 /**
50 * @return ReceiptDetail[]
51 */
52 public function getDetails(): array
53 {
54 return $this->receiptDetails;
55 }
56
57 /**
58 * @since 3.0.0
59 */
60 public function toArray(): array
61 {
62 return array_map(static function (ReceiptDetail $receiptDetail) {
63 return $receiptDetail->toArray();
64 }, $this->receiptDetails);
65 }
66 }
67