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

ReceiptLine::setSubTotal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
19
class ReceiptLine
20
{
21
    private $id;
22
23
    private Receipt $receipt;
24
25
    private string $currency;
26
27
    private int $total;
28
29
    private int $subTotal;
30
31
    private int $vatTotal;
32
33
    private float $vatPercentage;
34
35
    private ?string $description = null;
36
37
    public function getId()
38
    {
39
        return $this->id;
40
    }
41
42
    public function setId($id): void
43
    {
44
        $this->id = $id;
45
    }
46
47
    public function getReceipt(): Receipt
48
    {
49
        return $this->receipt;
50
    }
51
52
    public function setReceipt(Receipt $receipt): void
53
    {
54
        $this->receipt = $receipt;
55
    }
56
57
    public function getCurrency(): string
58
    {
59
        return $this->currency;
60
    }
61
62
    public function setCurrency(string $currency): void
63
    {
64
        $this->currency = $currency;
65
    }
66
67
    public function getTotal(): int
68
    {
69
        return $this->total;
70
    }
71
72
    public function setTotal(int $total): void
73
    {
74
        $this->total = $total;
75
    }
76
77
    public function getSubTotal(): int
78
    {
79
        return $this->subTotal;
80
    }
81
82
    public function setSubTotal(int $subTotal): void
83
    {
84
        $this->subTotal = $subTotal;
85
    }
86
87
    public function getVatTotal(): int
88
    {
89
        return $this->vatTotal;
90
    }
91
92
    public function setVatTotal(int $vatTotal): void
93
    {
94
        $this->vatTotal = $vatTotal;
95
    }
96
97
    public function getDescription(): string
98
    {
99
        return $this->description;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->description could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
100
    }
101
102
    public function setDescription(?string $description): void
103
    {
104
        $this->description = $description;
105
    }
106
107
    public function getTotalMoney(): Money
108
    {
109
        return Money::ofMinor($this->total, strtoupper($this->currency));
110
    }
111
112
    public function getVatTotalMoney(): Money
113
    {
114
        return Money::ofMinor($this->vatTotal, strtoupper($this->currency));
115
    }
116
117
    public function getSubTotalMoney(): Money
118
    {
119
        return Money::ofMinor($this->subTotal, strtoupper($this->currency));
120
    }
121
122
    public function getVatPercentage(): float
123
    {
124
        return $this->vatPercentage;
125
    }
126
127
    public function setVatPercentage(float $vatPercentage): void
128
    {
129
        $this->vatPercentage = $vatPercentage;
130
    }
131
}
132