Passed
Push — main ( a58268...9c0f97 )
by Iain
04:35
created

Price::hasExternalReference()   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 0
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\Currency;
18
use Brick\Money\Money;
19
20
class Price
21
{
22
    private $id;
23
24
    private int $amount;
25
26
    private string $currency;
27
28
    private bool $recurring;
29
30
    private ?string $schedule = null;
31
32
    private ?string $externalReference = null;
33
34
    private bool $includingTax = true;
35
36
    /**
37
     * @return mixed
38
     */
39
    public function getId()
40
    {
41
        return $this->id;
42
    }
43
44
    /**
45
     * @param mixed $id
46
     */
47
    public function setId($id): void
48
    {
49
        $this->id = $id;
50
    }
51
52
    public function getAmount(): int
53
    {
54
        return $this->amount;
55
    }
56
57
    public function setAmount(int $amount): void
58
    {
59
        $this->amount = $amount;
60
    }
61
62
    public function getCurrency(): string
63
    {
64
        return $this->currency;
65
    }
66
67
    public function setCurrency(string $currency): void
68
    {
69
        $this->currency = $currency;
70
    }
71
72
    public function getExternalReference(): ?string
73
    {
74
        return $this->externalReference;
75
    }
76
77
    public function setExternalReference(?string $externalReference): void
78
    {
79
        $this->externalReference = $externalReference;
80
    }
81
82
    public function hasExternalReference(): bool
83
    {
84
        return isset($this->externalReference);
85
    }
86
87
    public function isRecurring(): bool
88
    {
89
        return $this->recurring;
90
    }
91
92
    public function setRecurring(bool $recurring): void
93
    {
94
        $this->recurring = $recurring;
95
    }
96
97
    public function getSchedule(): ?string
98
    {
99
        return $this->schedule;
100
    }
101
102
    public function setSchedule(?string $schedule): void
103
    {
104
        $this->schedule = $schedule;
105
    }
106
107
    public function isIncludingTax(): bool
108
    {
109
        return $this->includingTax;
110
    }
111
112
    public function setIncludingTax(bool $includingTax): void
113
    {
114
        $this->includingTax = $includingTax;
115
    }
116
117
    public function getAsMoney(): Money
118
    {
119
        return Money::ofMinor($this->amount, Currency::of($this->currency));
120
    }
121
}
122