Passed
Push — main ( 3a1441...396ba4 )
by Iain
04:26
created

Receipt   A

Complexity

Total Complexity 37

Size/Duplication

Total Lines 228
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 56
dl 0
loc 228
rs 9.44
c 0
b 0
f 0
wmc 37

37 Methods

Rating   Name   Duplication   Size   Complexity  
A getVatTotal() 0 3 1
A setBillerAddress() 0 3 1
A setCreatedAt() 0 3 1
A setVatPercentage() 0 3 1
A setVatTotal() 0 3 1
A getSubTotalMoney() 0 3 1
A getCreatedAt() 0 3 1
A getTotalMoney() 0 3 1
A setSubTotal() 0 3 1
A setComment() 0 3 1
A getSubTotal() 0 3 1
A setInvoiceNumber() 0 3 1
A isValid() 0 3 1
A setLines() 0 3 1
A getSubscriptions() 0 3 1
A getVatTotalMoney() 0 3 1
A setCurrency() 0 3 1
A getCustomer() 0 3 1
A getPayeeAddress() 0 3 1
A getTotal() 0 3 1
A getBillerAddress() 0 3 1
A __construct() 0 5 1
A getVatPercentage() 0 3 1
A setPayeeAddress() 0 3 1
A addPayment() 0 3 1
A setId() 0 3 1
A setSubscriptions() 0 3 1
A getComment() 0 3 1
A getInvoiceNumber() 0 3 1
A getLines() 0 3 1
A getCurrency() 0 3 1
A setValid() 0 3 1
A setTotal() 0 3 1
A getPayments() 0 3 1
A setCustomer() 0 3 1
A getId() 0 3 1
A setPayments() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright Iain Cambridge 2020-2023.
7
 *
8
 * Use of this software is governed by the Business Source License included in the LICENSE file and at https://getparthenon.com/docs/next/license.
9
 *
10
 * Change Date: TBD ( 3 years after 2.2.0 release )
11
 *
12
 * On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license specified in the LICENSE file.
13
 */
14
15
namespace Parthenon\Billing\Entity;
16
17
use Brick\Money\Money;
18
use Doctrine\Common\Collections\ArrayCollection;
19
use Doctrine\Common\Collections\Collection;
20
use Parthenon\Common\Address;
21
22
class Receipt
23
{
24
    private $id;
25
26
    private string $invoiceNumber;
27
28
    private bool $valid;
29
30
    private Address $billerAddress;
31
32
    private Address $payeeAddress;
33
34
    private CustomerInterface $customer;
35
36
    private array|Collection $payments;
37
38
    private array|Collection $subscriptions;
39
40
    private array|Collection $lines;
41
42
    private ?string $comment;
43
44
    private string $currency;
45
46
    private int $total;
47
48
    private int $subTotal;
49
50
    private int $vatTotal;
51
52
    private float $vatPercentage;
53
54
    private \DateTimeInterface $createdAt;
55
56
    public function __construct()
57
    {
58
        $this->payments = new ArrayCollection([]);
59
        $this->subscriptions = new ArrayCollection([]);
60
        $this->lines = new ArrayCollection([]);
61
    }
62
63
    public function getId()
64
    {
65
        return $this->id;
66
    }
67
68
    public function setId($id): void
69
    {
70
        $this->id = $id;
71
    }
72
73
    public function getInvoiceNumber(): string
74
    {
75
        return $this->invoiceNumber;
76
    }
77
78
    public function setInvoiceNumber(string $invoiceNumber): void
79
    {
80
        $this->invoiceNumber = $invoiceNumber;
81
    }
82
83
    public function isValid(): bool
84
    {
85
        return $this->valid;
86
    }
87
88
    public function setValid(bool $valid): void
89
    {
90
        $this->valid = $valid;
91
    }
92
93
    public function getBillerAddress(): Address
94
    {
95
        return $this->billerAddress;
96
    }
97
98
    public function setBillerAddress(Address $billerAddress): void
99
    {
100
        $this->billerAddress = $billerAddress;
101
    }
102
103
    public function getPayeeAddress(): Address
104
    {
105
        return $this->payeeAddress;
106
    }
107
108
    public function setPayeeAddress(Address $payeeAddress): void
109
    {
110
        $this->payeeAddress = $payeeAddress;
111
    }
112
113
    public function getCustomer(): CustomerInterface
114
    {
115
        return $this->customer;
116
    }
117
118
    public function setCustomer(CustomerInterface $customer): void
119
    {
120
        $this->customer = $customer;
121
    }
122
123
    public function addPayment(Payment $payment): void
124
    {
125
        $this->payments->add($payment);
126
    }
127
128
    /**
129
     * @return Collection|Payment[]
130
     */
131
    public function getPayments(): Collection|array
132
    {
133
        return $this->payments;
134
    }
135
136
    public function setPayments(Collection|array $payments): void
137
    {
138
        $this->payments = $payments;
139
    }
140
141
    public function getComment(): ?string
142
    {
143
        return $this->comment;
144
    }
145
146
    public function setComment(?string $comment): void
147
    {
148
        $this->comment = $comment;
149
    }
150
151
    public function getCurrency(): string
152
    {
153
        return $this->currency;
154
    }
155
156
    public function setCurrency(string $currency): void
157
    {
158
        $this->currency = $currency;
159
    }
160
161
    public function getTotal(): int
162
    {
163
        return $this->total;
164
    }
165
166
    public function setTotal(int $total): void
167
    {
168
        $this->total = $total;
169
    }
170
171
    public function getSubTotal(): int
172
    {
173
        return $this->subTotal;
174
    }
175
176
    public function setSubTotal(int $subTotal): void
177
    {
178
        $this->subTotal = $subTotal;
179
    }
180
181
    public function getVatTotal(): int
182
    {
183
        return $this->vatTotal;
184
    }
185
186
    public function setVatTotal(int $vatTotal): void
187
    {
188
        $this->vatTotal = $vatTotal;
189
    }
190
191
    public function getCreatedAt(): \DateTimeInterface
192
    {
193
        return $this->createdAt;
194
    }
195
196
    public function setCreatedAt(\DateTimeInterface $createdAt): void
197
    {
198
        $this->createdAt = $createdAt;
199
    }
200
201
    /**
202
     * @return Collection|ReceiptLine[]
203
     */
204
    public function getLines(): Collection|array
205
    {
206
        return $this->lines;
207
    }
208
209
    public function setLines(Collection|array $lines): void
210
    {
211
        $this->lines = $lines;
212
    }
213
214
    /**
215
     * @return Subscription[]|Collection
216
     */
217
    public function getSubscriptions(): Collection|array
218
    {
219
        return $this->subscriptions;
220
    }
221
222
    public function setSubscriptions(Collection|array $subscriptions): void
223
    {
224
        $this->subscriptions = $subscriptions;
225
    }
226
227
    public function getTotalMoney(): Money
228
    {
229
        return Money::ofMinor($this->total, strtoupper($this->currency));
230
    }
231
232
    public function getVatTotalMoney(): Money
233
    {
234
        return Money::ofMinor($this->vatTotal, strtoupper($this->currency));
235
    }
236
237
    public function getSubTotalMoney(): Money
238
    {
239
        return Money::ofMinor($this->subTotal, strtoupper($this->currency));
240
    }
241
242
    public function getVatPercentage(): float
243
    {
244
        return $this->vatPercentage;
245
    }
246
247
    public function setVatPercentage(float $vatPercentage): void
248
    {
249
        $this->vatPercentage = $vatPercentage;
250
    }
251
}
252