Passed
Push — main ( 48fe19...91a3be )
by Iain
16:03
created

ReceiptLine::getSubTotalMoney()   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
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
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 ?string $description = null;
34
35
    public function getId()
36
    {
37
        return $this->id;
38
    }
39
40
    public function setId($id): void
41
    {
42
        $this->id = $id;
43
    }
44
45
    public function getReceipt(): Receipt
46
    {
47
        return $this->receipt;
48
    }
49
50
    public function setReceipt(Receipt $receipt): void
51
    {
52
        $this->receipt = $receipt;
53
    }
54
55
    public function getCurrency(): string
56
    {
57
        return $this->currency;
58
    }
59
60
    public function setCurrency(string $currency): void
61
    {
62
        $this->currency = $currency;
63
    }
64
65
    public function getTotal(): int
66
    {
67
        return $this->total;
68
    }
69
70
    public function setTotal(int $total): void
71
    {
72
        $this->total = $total;
73
    }
74
75
    public function getSubTotal(): int
76
    {
77
        return $this->subTotal;
78
    }
79
80
    public function setSubTotal(int $subTotal): void
81
    {
82
        $this->subTotal = $subTotal;
83
    }
84
85
    public function getVatTotal(): int
86
    {
87
        return $this->vatTotal;
88
    }
89
90
    public function setVatTotal(int $vatTotal): void
91
    {
92
        $this->vatTotal = $vatTotal;
93
    }
94
95
    public function getDescription(): string
96
    {
97
        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...
98
    }
99
100
    public function setDescription(?string $description): void
101
    {
102
        $this->description = $description;
103
    }
104
105
    public function getTotalMoney(): Money
106
    {
107
        return Money::ofMinor($this->total, strtoupper($this->currency));
108
    }
109
110
    public function getVatTotalMoney(): Money
111
    {
112
        return Money::ofMinor($this->vatTotal, strtoupper($this->currency));
113
    }
114
115
    public function getSubTotalMoney(): Money
116
    {
117
        return Money::ofMinor($this->subTotal, strtoupper($this->currency));
118
    }
119
}
120