Passed
Push — main ( fe5069...66da9a )
by Iain
05:19
created

SubscriptionPlan::removeFeature()   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 1
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 addFeature(SubscriptionFeature $subscriptionFeature): void
140
    {
141
        if (!$this->features->contains($subscriptionFeature)) {
142
            $this->features->add($subscriptionFeature);
143
        }
144
    }
145
146
    public function removeFeature(SubscriptionFeature $subscriptionFeature): void
147
    {
148
        $this->features->removeElement($subscriptionFeature);
149
    }
150
151
    public function getDisplayName(): string
152
    {
153
        return $this->name;
154
    }
155
156
    public function isPerSeat(): bool
157
    {
158
        return $this->perSeat;
159
    }
160
161
    public function setPerSeat(bool $perSeat): void
162
    {
163
        $this->perSeat = $perSeat;
164
    }
165
166
    public function isFree(): bool
167
    {
168
        return $this->free;
169
    }
170
171
    public function setFree(bool $free): void
172
    {
173
        $this->free = $free;
174
    }
175
176
    public function getUserCount(): int
177
    {
178
        return $this->userCount;
179
    }
180
181
    public function setUserCount(int $userCount): void
182
    {
183
        $this->userCount = $userCount;
184
    }
185
186
    public function getFeatures(): Collection|array
187
    {
188
        return $this->features;
189
    }
190
191
    public function setFeatures(Collection|array $features): void
192
    {
193
        $this->features = $features;
194
    }
195
}
196