Passed
Push — main ( 45f47d...2b216b )
by Iain
04:30
created

Invoice::isValid()   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 $lines;
38
39
    private ?string $comment;
40
41
    private string $currency;
42
43
    private int $total;
44
45
    private int $subTotal;
46
47
    private int $vatTotal;
48
49
    private \DateTimeInterface $createdAt;
50
51
    public function __construct()
52
    {
53
        $this->payments = new ArrayCollection([]);
54
        $this->lines = new ArrayCollection([]);
55
    }
56
57
    public function getId()
58
    {
59
        return $this->id;
60
    }
61
62
    public function setId($id): void
63
    {
64
        $this->id = $id;
65
    }
66
67
    public function getInvoiceNumber(): string
68
    {
69
        return $this->invoiceNumber;
70
    }
71
72
    public function setInvoiceNumber(string $invoiceNumber): void
73
    {
74
        $this->invoiceNumber = $invoiceNumber;
75
    }
76
77
    public function isValid(): bool
78
    {
79
        return $this->valid;
80
    }
81
82
    public function setValid(bool $valid): void
83
    {
84
        $this->valid = $valid;
85
    }
86
87
    public function getBillerAddress(): Address
88
    {
89
        return $this->billerAddress;
90
    }
91
92
    public function setBillerAddress(Address $billerAddress): void
93
    {
94
        $this->billerAddress = $billerAddress;
95
    }
96
97
    public function getPayeeAddress(): Address
98
    {
99
        return $this->payeeAddress;
100
    }
101
102
    public function setPayeeAddress(Address $payeeAddress): void
103
    {
104
        $this->payeeAddress = $payeeAddress;
105
    }
106
107
    public function getCustomer(): CustomerInterface
108
    {
109
        return $this->customer;
110
    }
111
112
    public function setCustomer(CustomerInterface $customer): void
113
    {
114
        $this->customer = $customer;
115
    }
116
117
    public function addPayment(Payment $payment): void
118
    {
119
        $this->payments->add($payment);
120
    }
121
122
    /**
123
     * @return Collection|Payment[]
124
     */
125
    public function getPayments(): Collection|array
126
    {
127
        return $this->payments;
128
    }
129
130
    public function setPayments(Collection|array $payments): void
131
    {
132
        $this->payments = $payments;
133
    }
134
135
    public function getComment(): ?string
136
    {
137
        return $this->comment;
138
    }
139
140
    public function setComment(?string $comment): void
141
    {
142
        $this->comment = $comment;
143
    }
144
145
    public function getCurrency(): string
146
    {
147
        return $this->currency;
148
    }
149
150
    public function setCurrency(string $currency): void
151
    {
152
        $this->currency = $currency;
153
    }
154
155
    public function getTotal(): int
156
    {
157
        return $this->total;
158
    }
159
160
    public function setTotal(int $total): void
161
    {
162
        $this->total = $total;
163
    }
164
165
    public function getSubTotal(): int
166
    {
167
        return $this->subTotal;
168
    }
169
170
    public function setSubTotal(int $subTotal): void
171
    {
172
        $this->subTotal = $subTotal;
173
    }
174
175
    public function getVatTotal(): int
176
    {
177
        return $this->vatTotal;
178
    }
179
180
    public function setVatTotal(int $vatTotal): void
181
    {
182
        $this->vatTotal = $vatTotal;
183
    }
184
185
    public function getCreatedAt(): \DateTimeInterface
186
    {
187
        return $this->createdAt;
188
    }
189
190
    public function setCreatedAt(\DateTimeInterface $createdAt): void
191
    {
192
        $this->createdAt = $createdAt;
193
    }
194
195
    /**
196
     * @return Collection|InvoiceLine[]
197
     */
198
    public function getLines(): Collection|array
199
    {
200
        return $this->lines;
201
    }
202
203
    public function setLines(Collection|array $lines): void
204
    {
205
        $this->lines = $lines;
206
    }
207
}
208