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