Passed
Push — main ( 2ae1e3...bfdcab )
by Iain
16:28
created

SubscriptionPlan::getPaymentProviderDetailsLink()   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 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 $paymentProviderDetailsLink = 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
    private array|Collection $prices;
43
44
    public function __construct()
45
    {
46
        $this->limits = new ArrayCollection();
47
        $this->features = new ArrayCollection();
48
        $this->prices = new ArrayCollection();
49
    }
50
51
    /**
52
     * @return mixed
53
     */
54
    public function getId()
55
    {
56
        return $this->id;
57
    }
58
59
    /**
60
     * @param mixed $id
61
     */
62
    public function setId($id): void
63
    {
64
        $this->id = $id;
65
    }
66
67
    public function isPublic(): bool
68
    {
69
        return $this->public;
70
    }
71
72
    public function setPublic(bool $public): void
73
    {
74
        $this->public = $public;
75
    }
76
77
    public function getName(): string
78
    {
79
        return $this->name;
80
    }
81
82
    public function setName(string $name): void
83
    {
84
        $this->name = $name;
85
    }
86
87
    /**
88
     * @return string
89
     */
90
    public function getExternalReference(): ?string
91
    {
92
        return $this->externalReference;
93
    }
94
95
    public function setExternalReference(string $externalReference): void
96
    {
97
        $this->externalReference = $externalReference;
98
    }
99
100
    public function hasExternalReference(): bool
101
    {
102
        return isset($this->externalReference);
103
    }
104
105
    public function getPaymentProviderDetailsLink(): ?string
106
    {
107
        return $this->paymentProviderDetailsLink;
108
    }
109
110
    public function setPaymentProviderDetailsLink(?string $paymentProviderDetailsLink): void
111
    {
112
        $this->paymentProviderDetailsLink = $paymentProviderDetailsLink;
113
    }
114
115
    public function getLimits(): Collection|array
116
    {
117
        return $this->limits;
118
    }
119
120
    /**
121
     * @param SubscriptionPlanLimit[]|Collection $limits
122
     */
123
    public function setLimits(Collection|array $limits): void
124
    {
125
        $this->limits = $limits;
126
    }
127
128
    public function addLimit(SubscriptionPlanLimit $limit): void
129
    {
130
        if (!$this->limits->contains($limit)) {
131
            $limit->setSubscriptionPlan($this);
132
            $this->limits->add($limit);
133
        }
134
    }
135
136
    public function removeLimit(SubscriptionPlanLimit $limit): void
137
    {
138
        $this->limits->removeElement($limit);
139
    }
140
141
    public function addFeature(SubscriptionFeature $subscriptionFeature): void
142
    {
143
        if (!$this->features->contains($subscriptionFeature)) {
144
            $this->features->add($subscriptionFeature);
145
        }
146
    }
147
148
    public function removeFeature(SubscriptionFeature $subscriptionFeature): void
149
    {
150
        $this->features->removeElement($subscriptionFeature);
151
    }
152
153
    public function addPrice(Price $price): void
154
    {
155
        if (!$this->prices->contains($price)) {
156
            $this->prices->add($price);
157
        }
158
    }
159
160
    public function removePrice(Price $price): void
161
    {
162
        $this->prices->removeElement($price);
163
    }
164
165
    public function getPrices(): Collection|array
166
    {
167
        return $this->prices;
168
    }
169
170
    public function setPrices(Collection|array $prices): void
171
    {
172
        $this->prices = $prices;
173
    }
174
175
    public function getDisplayName(): string
176
    {
177
        return $this->name;
178
    }
179
180
    public function isPerSeat(): bool
181
    {
182
        return $this->perSeat;
183
    }
184
185
    public function setPerSeat(bool $perSeat): void
186
    {
187
        $this->perSeat = $perSeat;
188
    }
189
190
    public function isFree(): bool
191
    {
192
        return $this->free;
193
    }
194
195
    public function setFree(bool $free): void
196
    {
197
        $this->free = $free;
198
    }
199
200
    public function getUserCount(): int
201
    {
202
        return $this->userCount;
203
    }
204
205
    public function setUserCount(int $userCount): void
206
    {
207
        $this->userCount = $userCount;
208
    }
209
210
    public function getFeatures(): Collection|array
211
    {
212
        return $this->features;
213
    }
214
215
    public function setFeatures(Collection|array $features): void
216
    {
217
        $this->features = $features;
218
    }
219
}
220