Passed
Push — main ( 6e6ff6...082362 )
by Iain
05:02
created

SubscriptionPlan::isFree()   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
c 0
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\Athena\Entity\CrudEntityInterface;
20
21
class SubscriptionPlan implements CrudEntityInterface
22
{
23
    private $id;
24
25
    private bool $public = false;
26
27
    private string $name;
28
29
    private ?string $externalReference = null;
30
31
    private ?string $externalReferenceLink = null;
32
33
    private array|Collection $limits;
34
35
    private bool $perSeat;
36
37
    private bool $free;
38
39
    private int $userCount;
40
41
    private array|Collection $features;
42
43
    public function __construct()
44
    {
45
        $this->limits = new ArrayCollection();
46
        $this->features = new ArrayCollection();
47
    }
48
49
    /**
50
     * @return mixed
51
     */
52
    public function getId()
53
    {
54
        return $this->id;
55
    }
56
57
    /**
58
     * @param mixed $id
59
     */
60
    public function setId($id): void
61
    {
62
        $this->id = $id;
63
    }
64
65
    public function isPublic(): bool
66
    {
67
        return $this->public;
68
    }
69
70
    public function setPublic(bool $public): void
71
    {
72
        $this->public = $public;
73
    }
74
75
    public function getName(): string
76
    {
77
        return $this->name;
78
    }
79
80
    public function setName(string $name): void
81
    {
82
        $this->name = $name;
83
    }
84
85
    /**
86
     * @return string
87
     */
88
    public function getExternalReference(): ?string
89
    {
90
        return $this->externalReference;
91
    }
92
93
    public function setExternalReference(string $externalReference): void
94
    {
95
        $this->externalReference = $externalReference;
96
    }
97
98
    public function hasExternalReference(): bool
99
    {
100
        return isset($this->externalReference);
101
    }
102
103
    public function getExternalReferenceLink(): ?string
104
    {
105
        return $this->externalReferenceLink;
106
    }
107
108
    public function setExternalReferenceLink(?string $externalReferenceLink): void
109
    {
110
        $this->externalReferenceLink = $externalReferenceLink;
111
    }
112
113
    public function getLimits(): Collection|array
114
    {
115
        return $this->limits;
116
    }
117
118
    /**
119
     * @param SubscriptionPlanLimit[]|Collection $limits
120
     */
121
    public function setLimits(Collection|array $limits): void
122
    {
123
        $this->limits = $limits;
124
    }
125
126
    public function addLimit(SubscriptionPlanLimit $limit): void
127
    {
128
        if (!$this->limits->contains($limit)) {
129
            $limit->setSubscriptionPlan($this);
130
            $this->limits->add($limit);
131
        }
132
    }
133
134
    public function removeLimit(SubscriptionPlanLimit $limit): void
135
    {
136
        $this->limits->removeElement($limit);
137
    }
138
139
    public function getDisplayName(): string
140
    {
141
        return $this->name;
142
    }
143
144
    public function isPerSeat(): bool
145
    {
146
        return $this->perSeat;
147
    }
148
149
    public function setPerSeat(bool $perSeat): void
150
    {
151
        $this->perSeat = $perSeat;
152
    }
153
154
    public function isFree(): bool
155
    {
156
        return $this->free;
157
    }
158
159
    public function setFree(bool $free): void
160
    {
161
        $this->free = $free;
162
    }
163
164
    public function getUserCount(): int
165
    {
166
        return $this->userCount;
167
    }
168
169
    public function setUserCount(int $userCount): void
170
    {
171
        $this->userCount = $userCount;
172
    }
173
174
    public function getFeatures(): Collection|array
175
    {
176
        return $this->features;
177
    }
178
179
    public function setFeatures(Collection|array $features): void
180
    {
181
        $this->features = $features;
182
    }
183
}
184