PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Domain / Entity / Coupon / Coupon.php
ameliabooking / src / Domain / Entity / Coupon Last commit date
Coupon.php 1 year ago
Coupon.php
377 lines
1 <?php
2 /**
3 * @copyright © TMS-Plugins. All rights reserved.
4 * @licence See LICENCE.md for license details.
5 */
6
7 namespace AmeliaBooking\Domain\Entity\Coupon;
8
9 use AmeliaBooking\Domain\Collection\Collection;
10 use AmeliaBooking\Domain\ValueObjects\BooleanValueObject;
11 use AmeliaBooking\Domain\ValueObjects\DateTime\DateTimeValue;
12 use AmeliaBooking\Domain\ValueObjects\DiscountFixedValue;
13 use AmeliaBooking\Domain\ValueObjects\DiscountPercentageValue;
14 use AmeliaBooking\Domain\ValueObjects\Number\Integer\PositiveInteger;
15 use AmeliaBooking\Domain\ValueObjects\Number\Integer\WholeNumber;
16 use AmeliaBooking\Domain\ValueObjects\String\CouponCode;
17 use AmeliaBooking\Domain\ValueObjects\String\Status;
18 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
19
20 /**
21 * Class Coupon
22 *
23 * @package AmeliaBooking\Domain\Entity\Coupon
24 */
25 class Coupon
26 {
27 /** @var Id */
28 private $id;
29
30 /** @var CouponCode */
31 private $code;
32
33 /** @var DiscountPercentageValue */
34 private $discount;
35
36 /** @var DiscountFixedValue */
37 private $deduction;
38
39 /** @var PositiveInteger */
40 private $limit;
41
42 /** @var WholeNumber */
43 private $customerLimit;
44
45 /** @var WholeNumber */
46 private $used;
47
48 /** @var WholeNumber */
49 private $notificationInterval;
50
51 /** @var BooleanValueObject */
52 private $notificationRecurring;
53
54 /** @var Status */
55 private $status;
56
57 /** @var Collection */
58 private $serviceList;
59
60 /** @var Collection */
61 private $eventList;
62
63 /** @var Collection */
64 private $packageList;
65
66 /** @var DateTimeValue */
67 private $expirationDate;
68
69 /** @var BooleanValueObject */
70 private $allServices;
71
72 /** @var BooleanValueObject */
73 private $allEvents;
74
75
76 /** @var BooleanValueObject */
77 private $allPackages;
78
79 /**
80 * @return Id
81 */
82 public function getId()
83 {
84 return $this->id;
85 }
86
87 /**
88 * @param Id $id
89 */
90 public function setId($id)
91 {
92 $this->id = $id;
93 }
94
95 /**
96 * @return CouponCode
97 */
98 public function getCode()
99 {
100 return $this->code;
101 }
102
103 /**
104 * @param CouponCode $code
105 */
106 public function setCode(CouponCode $code)
107 {
108 $this->code = $code;
109 }
110
111 /**
112 * @return DiscountPercentageValue
113 */
114 public function getDiscount()
115 {
116 return $this->discount;
117 }
118
119 /**
120 * @param DiscountPercentageValue $discount
121 */
122 public function setDiscount(DiscountPercentageValue $discount)
123 {
124 $this->discount = $discount;
125 }
126
127 /**
128 * @return DiscountFixedValue
129 */
130 public function getDeduction()
131 {
132 return $this->deduction;
133 }
134
135 /**
136 * @param DiscountFixedValue $deduction
137 */
138 public function setDeduction(DiscountFixedValue $deduction)
139 {
140 $this->deduction = $deduction;
141 }
142
143 /**
144 * @return PositiveInteger
145 */
146 public function getLimit()
147 {
148 return $this->limit;
149 }
150
151 /**
152 * @param PositiveInteger $limit
153 */
154 public function setLimit($limit)
155 {
156 $this->limit = $limit;
157 }
158
159 /**
160 * @return WholeNumber
161 */
162 public function getCustomerLimit()
163 {
164 return $this->customerLimit;
165 }
166
167 /**
168 * @param WholeNumber $customerLimit
169 */
170 public function setCustomerLimit($customerLimit)
171 {
172 $this->customerLimit = $customerLimit;
173 }
174
175 /**
176 * @return WholeNumber
177 */
178 public function getUsed()
179 {
180 return $this->used;
181 }
182
183 /**
184 * @param WholeNumber $used
185 */
186 public function setUsed($used)
187 {
188 $this->used = $used;
189 }
190
191 /**
192 * @return WholeNumber
193 */
194 public function getNotificationInterval()
195 {
196 return $this->notificationInterval;
197 }
198
199 /**
200 * @param WholeNumber $notificationInterval
201 */
202 public function setNotificationInterval($notificationInterval)
203 {
204 $this->notificationInterval = $notificationInterval;
205 }
206
207 /**
208 * @return BooleanValueObject
209 */
210 public function getNotificationRecurring()
211 {
212 return $this->notificationRecurring;
213 }
214
215 /**
216 * @param BooleanValueObject $notificationRecurring
217 */
218 public function setNotificationRecurring($notificationRecurring)
219 {
220 $this->notificationRecurring = $notificationRecurring;
221 }
222
223 /**
224 * @return Status
225 */
226 public function getStatus()
227 {
228 return $this->status;
229 }
230
231 /**
232 * @param Status $status
233 */
234 public function setStatus(Status $status)
235 {
236 $this->status = $status;
237 }
238
239 /**
240 * @return Collection
241 */
242 public function getServiceList()
243 {
244 return $this->serviceList;
245 }
246
247 /**
248 * @param Collection $serviceList
249 */
250 public function setServiceList(Collection $serviceList)
251 {
252 $this->serviceList = $serviceList;
253 }
254
255 /**
256 * @return Collection
257 */
258 public function getEventList()
259 {
260 return $this->eventList;
261 }
262
263 /**
264 * @param Collection $eventList
265 */
266 public function setEventList(Collection $eventList)
267 {
268 $this->eventList = $eventList;
269 }
270
271 /**
272 * @return Collection
273 */
274 public function getPackageList()
275 {
276 return $this->packageList;
277 }
278
279 /**
280 * @param Collection $packageList
281 */
282 public function setPackageList(Collection $packageList)
283 {
284 $this->packageList = $packageList;
285 }
286
287 /**
288 * @return DateTimeValue
289 */
290 public function getExpirationDate()
291 {
292 return $this->expirationDate;
293 }
294
295 /**
296 * @param DateTimeValue $expirationDate
297 */
298 public function setExpirationDate(DateTimeValue $expirationDate)
299 {
300 $this->expirationDate = $expirationDate;
301 }
302
303 /**
304 * @return BooleanValueObject
305 */
306 public function getAllServices()
307 {
308 return $this->allServices;
309 }
310
311 /**
312 * @param BooleanValueObject $allServices
313 */
314 public function setAllServices($allServices)
315 {
316 $this->allServices = $allServices;
317 }
318
319 /**
320 * @return BooleanValueObject
321 */
322 public function getAllEvents()
323 {
324 return $this->allEvents;
325 }
326
327 /**
328 * @param BooleanValueObject $allEvents
329 */
330 public function setAllEvents($allEvents)
331 {
332 $this->allEvents = $allEvents;
333 }
334
335 /**
336 * @return BooleanValueObject
337 */
338 public function getAllPackages()
339 {
340 return $this->allPackages;
341 }
342
343 /**
344 * @param BooleanValueObject $allPackages
345 */
346 public function setAllPackages($allPackages)
347 {
348 $this->allPackages = $allPackages;
349 }
350
351 /**
352 * @return array
353 */
354 public function toArray()
355 {
356 return [
357 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
358 'code' => $this->getCode() ? $this->getCode()->getValue() : null,
359 'discount' => $this->getDiscount() ? $this->getDiscount()->getValue() : null,
360 'deduction' => $this->getDeduction() ? $this->getDeduction()->getValue() : null,
361 'limit' => $this->getLimit() ? $this->getLimit()->getValue() : null,
362 'customerLimit' => $this->getCustomerLimit() ? $this->getCustomerLimit()->getValue() : 0,
363 'used' => $this->getUsed() ? $this->getUsed()->getValue() : 0,
364 'notificationInterval' => $this->getNotificationInterval() ? $this->getNotificationInterval()->getValue() : 0,
365 'notificationRecurring' => $this->getNotificationRecurring() ? $this->getNotificationRecurring()->getValue() : 0,
366 'status' => $this->getStatus() ? $this->getStatus()->getValue() : null,
367 'serviceList' => $this->getServiceList() ? $this->getServiceList()->toArray() : [],
368 'eventList' => $this->getEventList() ? $this->getEventList()->toArray() : [],
369 'packageList' => $this->getPackageList() ? $this->getPackageList()->toArray() : [],
370 'expirationDate' => $this->getExpirationDate() ? $this->getExpirationDate()->getValue()->format('Y-m-d') : null,
371 'allServices' => $this->getAllServices() ? $this->getAllServices()->getValue() : 0,
372 'allEvents' => $this->getAllEvents() ? $this->getAllEvents()->getValue() : 0,
373 'allPackages' => $this->getAllPackages() ? $this->getAllPackages()->getValue() : 0,
374 ];
375 }
376 }
377