BlockTime.php
2 months ago
DayOff.php
2 months ago
Period.php
6 months ago
PeriodLocation.php
6 months ago
PeriodService.php
6 months ago
SpecialDay.php
6 months ago
SpecialDayPeriod.php
6 months ago
SpecialDayPeriodLocation.php
6 months ago
SpecialDayPeriodService.php
6 months ago
TimeOut.php
6 months ago
WeekDay.php
6 months ago
SpecialDay.php
127 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\Schedule; |
| 9 | |
| 10 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 11 | use AmeliaBooking\Domain\ValueObjects\DateTime\DateTimeValue; |
| 12 | use AmeliaBooking\Domain\Collection\Collection; |
| 13 | |
| 14 | /** |
| 15 | * Class SpecialDay |
| 16 | * |
| 17 | * @package AmeliaBooking\Domain\Entity\Schedule |
| 18 | */ |
| 19 | class SpecialDay |
| 20 | { |
| 21 | /** @var Id */ |
| 22 | private $id; |
| 23 | |
| 24 | /** @var DateTimeValue */ |
| 25 | private $startDate; |
| 26 | |
| 27 | /** @var DateTimeValue */ |
| 28 | private $endDate; |
| 29 | |
| 30 | /** @var Collection */ |
| 31 | private $periodList; |
| 32 | |
| 33 | /** |
| 34 | * SpecialDay constructor. |
| 35 | * |
| 36 | * @param DateTimeValue $startDate |
| 37 | * @param DateTimeValue $endDate |
| 38 | * @param Collection $periodList |
| 39 | */ |
| 40 | public function __construct( |
| 41 | DateTimeValue $startDate, |
| 42 | DateTimeValue $endDate, |
| 43 | Collection $periodList |
| 44 | ) { |
| 45 | $this->startDate = $startDate; |
| 46 | $this->endDate = $endDate; |
| 47 | $this->periodList = $periodList; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @return Id |
| 52 | */ |
| 53 | public function getId() |
| 54 | { |
| 55 | return $this->id; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * @param Id $id |
| 60 | */ |
| 61 | public function setId(Id $id) |
| 62 | { |
| 63 | $this->id = $id; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * @return DateTimeValue |
| 68 | */ |
| 69 | public function getStartDate() |
| 70 | { |
| 71 | return $this->startDate; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * @param DateTimeValue $startDate |
| 76 | */ |
| 77 | public function setStartDate(DateTimeValue $startDate) |
| 78 | { |
| 79 | $this->startDate = $startDate; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * @return DateTimeValue |
| 84 | */ |
| 85 | public function getEndDate() |
| 86 | { |
| 87 | return $this->endDate; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * @param DateTimeValue $endDate |
| 92 | */ |
| 93 | public function setEndDate(DateTimeValue $endDate) |
| 94 | { |
| 95 | $this->endDate = $endDate; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * @return Collection |
| 100 | */ |
| 101 | public function getPeriodList() |
| 102 | { |
| 103 | return $this->periodList; |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * @param Collection $periodList |
| 108 | */ |
| 109 | public function setPeriodList(Collection $periodList) |
| 110 | { |
| 111 | $this->periodList = $periodList; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * @return array |
| 116 | */ |
| 117 | public function toArray() |
| 118 | { |
| 119 | return [ |
| 120 | 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, |
| 121 | 'startDate' => $this->startDate->getValue()->format('Y-m-d'), |
| 122 | 'endDate' => $this->endDate->getValue()->format('Y-m-d'), |
| 123 | 'periodList' => $this->periodList->toArray(), |
| 124 | ]; |
| 125 | } |
| 126 | } |
| 127 |