DayOff.php
6 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
DayOff.php
151 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\ValueObjects\Number\Integer\DateRepeat; |
| 13 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 14 | |
| 15 | /** |
| 16 | * Class DayOff |
| 17 | * |
| 18 | * @package AmeliaBooking\Domain\Entity\Schedule |
| 19 | */ |
| 20 | class DayOff |
| 21 | { |
| 22 | /** @var Id */ |
| 23 | private $id; |
| 24 | |
| 25 | /** @var Name */ |
| 26 | private $name; |
| 27 | |
| 28 | /** @var DateTimeValue */ |
| 29 | private $startDate; |
| 30 | |
| 31 | /** @var DateTimeValue */ |
| 32 | private $endDate; |
| 33 | |
| 34 | /** @var DateRepeat */ |
| 35 | private $repeat; |
| 36 | |
| 37 | /** |
| 38 | * DayOff constructor. |
| 39 | * |
| 40 | * @param Name $name |
| 41 | * @param DateTimeValue $startDate |
| 42 | * @param DateTimeValue $endDate |
| 43 | * @param DateRepeat $repeat |
| 44 | */ |
| 45 | public function __construct( |
| 46 | Name $name, |
| 47 | DateTimeValue $startDate, |
| 48 | DateTimeValue $endDate, |
| 49 | DateRepeat $repeat |
| 50 | ) { |
| 51 | $this->name = $name; |
| 52 | $this->startDate = $startDate; |
| 53 | $this->endDate = $endDate; |
| 54 | $this->repeat = $repeat; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @return Id |
| 59 | */ |
| 60 | public function getId() |
| 61 | { |
| 62 | return $this->id; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * @param Id $id |
| 67 | */ |
| 68 | public function setId(Id $id) |
| 69 | { |
| 70 | $this->id = $id; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @return DateTimeValue |
| 75 | */ |
| 76 | public function getStartDate() |
| 77 | { |
| 78 | return $this->startDate; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * @param DateTimeValue $startDate |
| 83 | */ |
| 84 | public function setStartDate(DateTimeValue $startDate) |
| 85 | { |
| 86 | $this->startDate = $startDate; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * @return DateTimeValue |
| 91 | */ |
| 92 | public function getEndDate() |
| 93 | { |
| 94 | return $this->endDate; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * @param DateTimeValue $endDate |
| 99 | */ |
| 100 | public function setEndDate(DateTimeValue $endDate) |
| 101 | { |
| 102 | $this->endDate = $endDate; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * @return DateRepeat |
| 107 | */ |
| 108 | public function getRepeat() |
| 109 | { |
| 110 | return $this->repeat; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * @param DateRepeat $repeat |
| 115 | */ |
| 116 | public function setRepeat(DateRepeat $repeat) |
| 117 | { |
| 118 | $this->repeat = $repeat; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * @return Name |
| 123 | */ |
| 124 | public function getName() |
| 125 | { |
| 126 | return $this->name; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * @param Name $name |
| 131 | */ |
| 132 | public function setName(Name $name) |
| 133 | { |
| 134 | $this->name = $name; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * @return array |
| 139 | */ |
| 140 | public function toArray() |
| 141 | { |
| 142 | return [ |
| 143 | 'id' => null !== $this->id ? $this->id->getValue() : null, |
| 144 | 'name' => $this->name->getValue(), |
| 145 | 'startDate' => $this->startDate->getValue()->format('Y-m-d'), |
| 146 | 'endDate' => $this->endDate->getValue()->format('Y-m-d'), |
| 147 | 'repeat' => $this->repeat->getValue(), |
| 148 | ]; |
| 149 | } |
| 150 | } |
| 151 |