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
TimeOut.php
103 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 | |
| 13 | /** |
| 14 | * Class TimeOut |
| 15 | * |
| 16 | * @package AmeliaBooking\Domain\Entity\Schedule |
| 17 | */ |
| 18 | class TimeOut |
| 19 | { |
| 20 | /** @var Id */ |
| 21 | private $id; |
| 22 | |
| 23 | /** @var DateTimeValue */ |
| 24 | private $startTime; |
| 25 | |
| 26 | /** @var DateTimeValue */ |
| 27 | private $endTime; |
| 28 | |
| 29 | /** |
| 30 | * TimeOut constructor. |
| 31 | * |
| 32 | * @param DateTimeValue $startTime |
| 33 | * @param DateTimeValue $endTime |
| 34 | */ |
| 35 | public function __construct( |
| 36 | DateTimeValue $startTime, |
| 37 | DateTimeValue $endTime |
| 38 | ) { |
| 39 | $this->startTime = $startTime; |
| 40 | $this->endTime = $endTime; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @return Id |
| 45 | */ |
| 46 | public function getId() |
| 47 | { |
| 48 | return $this->id; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * @param Id $id |
| 53 | */ |
| 54 | public function setId(Id $id) |
| 55 | { |
| 56 | $this->id = $id; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * @return DateTimeValue |
| 61 | */ |
| 62 | public function getStartTime() |
| 63 | { |
| 64 | return $this->startTime; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @param DateTimeValue $startTime |
| 69 | */ |
| 70 | public function setStartTime(DateTimeValue $startTime) |
| 71 | { |
| 72 | $this->startTime = $startTime; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @return DateTimeValue |
| 77 | */ |
| 78 | public function getEndTime() |
| 79 | { |
| 80 | return $this->endTime; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @param DateTimeValue $endTime |
| 85 | */ |
| 86 | public function setEndTime(DateTimeValue $endTime) |
| 87 | { |
| 88 | $this->endTime = $endTime; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * @return array |
| 93 | */ |
| 94 | public function toArray() |
| 95 | { |
| 96 | return [ |
| 97 | 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, |
| 98 | 'startTime' => $this->startTime->getValue()->format('H:i:s'), |
| 99 | 'endTime' => $this->endTime->getValue()->format('H:i:s'), |
| 100 | ]; |
| 101 | } |
| 102 | } |
| 103 |