Passed
Push — main ( c81eb8...7d97d9 )
by Iain
04:22
created

Invoice::getSubTotal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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 Doctrine\Common\Collections\ArrayCollection;
18
use Doctrine\Common\Collections\Collection;
19
use Parthenon\Common\Address;
20
21
class Invoice
22
{
23
    private $id;
24
25
    private string $invoiceNumber;
26
27
    private bool $valid;
28
29
    private Address $billerAddress;
30
31
    private Address $payeeAddress;
32
33
    private CustomerInterface $customer;
34
35
    private array|Collection $payments;
36
37
    private array|Collection $subscriptions;
38
39
    private array|Collection $lines;
40
41
    private ?string $comment;
42
43
    private string $currency;
44
45
    private int $total;
46
47
    private int $subTotal;
48
49
    private int $vatTotal;
50
51
    private \DateTimeInterface $createdAt;
52
53
    public function __construct()
54
    {
55
        $this->payments = new ArrayCollection([]);
56
        $this->subscriptions = new ArrayCollection([]);
57
        $this->lines = new ArrayCollection([]);
58
    }
59
60
    public function getId()
61
    {
62
        return $this->id;
63
    }
64
65
    public function setId($id): void
66
    {
67
        $this->id = $id;
68
    }
69
70
    public function getInvoiceNumber(): string
71
    {
72
        return $this->invoiceNumber;
73
    }
74
75
    public function setInvoiceNumber(string $invoiceNumber): void
76
    {
77
        $this->invoiceNumber = $invoiceNumber;
78
    }
79
80
    public function isValid(): bool
81
    {
82
        return $this->valid;
83
    }
84
85
    public function setValid(bool $valid): void
86
    {
87
        $this->valid = $valid;
88
    }
89
90
    public function getBillerAddress(): Address
91
    {
92
        return $this->billerAddress;
93
    }
94
95
    public function setBillerAddress(Address $billerAddress): void
96
    {
97
        $this->billerAddress = $billerAddress;
98
    }
99
100
    public function getPayeeAddress(): Address
101
    {
102
        return $this->payeeAddress;
103
    }
104
105
    public function setPayeeAddress(Address $payeeAddress): void
106
    {
107
        $this->payeeAddress = $payeeAddress;
108
    }
109
110
    public function getCustomer(): CustomerInterface
111
    {
112
        return $this->customer;
113
    }
114
115
    public function setCustomer(CustomerInterface $customer): void
116
    {
117
        $this->customer = $customer;
118
    }
119
120
    public function addPayment(Payment $payment): void
121
    {
122
        $this->payments->add($payment);
123
    }
124
125
    /**
126
     * @return Collection|Payment[]
127
     */
128
    public function getPayments(): Collection|array
129
    {
130
        return $this->payments;
131
    }
132
133
    public function setPayments(Collection|array $payments): void
134
    {
135
        $this->payments = $payments;
136
    }
137
138
    public function getComment(): ?string
139
    {
140
        return $this->comment;
141
    }
142
143
    public function setComment(?string $comment): void
144
    {
145
        $this->comment = $comment;
146
    }
147
148
    public function getCurrency(): string
149
    {
150
        return $this->currency;
151
    }
152
153
    public function setCurrency(string $currency): void
154
    {
155
        $this->currency = $currency;
156
    }
157
158
    public function getTotal(): int
159
    {
160
        return $this->total;
161
    }
162
163
    public function setTotal(int $total): void
164
    {
165
        $this->total = $total;
166
    }
167
168
    public function getSubTotal(): int
169
    {
170
        return $this->subTotal;
171
    }
172
173
    public function setSubTotal(int $subTotal): void
174
    {
175
        $this->subTotal = $subTotal;
176
    }
177
178
    public function getVatTotal(): int
179
    {
180
        return $this->vatTotal;
181
    }
182
183
    public function setVatTotal(int $vatTotal): void
184
    {
185
        $this->vatTotal = $vatTotal;
186
    }
187
188
    public function getCreatedAt(): \DateTimeInterface
189
    {
190
        return $this->createdAt;
191
    }
192
193
    public function setCreatedAt(\DateTimeInterface $createdAt): void
194
    {
195
        $this->createdAt = $createdAt;
196
    }
197
198
    /**
199
     * @return Collection|InvoiceLine[]
200
     */
201
    public function getLines(): Collection|array
202
    {
203
        return $this->lines;
204
    }
205
206
    public function setLines(Collection|array $lines): void
207
    {
208
        $this->lines = $lines;
209
    }
210
211
    /**
212
     * @return Subscription[]|Collection
213
     */
214
    public function getSubscriptions(): Collection|array
215
    {
216
        return $this->subscriptions;
217
    }
218
219
    public function setSubscriptions(Collection|array $subscriptions): void
220
    {
221
        $this->subscriptions = $subscriptions;
222
    }
223
}
224