PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / trunk
Booking for Appointments and Events Calendar – Amelia vtrunk
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 / Schedule / WeekDay.php
ameliabooking / src / Domain / Entity / Schedule Last commit date
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
WeekDay.php
175 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\Number\Integer\IntegerValue;
12 use AmeliaBooking\Domain\ValueObjects\DateTime\DateTimeValue;
13 use AmeliaBooking\Domain\Collection\Collection;
14
15 /**
16 * Class WeekDay
17 *
18 * @package AmeliaBooking\Domain\Entity\Schedule
19 */
20 class WeekDay
21 {
22 /** @var Id */
23 private $id;
24
25 /** @var IntegerValue */
26 private $dayIndex;
27
28 /** @var DateTimeValue */
29 private $startTime;
30
31 /** @var DateTimeValue */
32 private $endTime;
33
34 /** @var Collection */
35 private $timeOutList;
36
37 /** @var Collection */
38 private $periodList;
39
40 /**
41 * WeekDay constructor.
42 *
43 * @param IntegerValue $dayIndex
44 * @param DateTimeValue $startTime
45 * @param DateTimeValue $endTime
46 * @param Collection $timeOutList
47 * @param Collection $periodList
48 */
49 public function __construct(
50 IntegerValue $dayIndex,
51 DateTimeValue $startTime,
52 DateTimeValue $endTime,
53 Collection $timeOutList,
54 Collection $periodList
55 ) {
56 $this->dayIndex = $dayIndex;
57 $this->startTime = $startTime;
58 $this->endTime = $endTime;
59 $this->timeOutList = $timeOutList;
60 $this->periodList = $periodList;
61 }
62
63 /**
64 * @return Id
65 */
66 public function getId()
67 {
68 return $this->id;
69 }
70
71 /**
72 * @param Id $id
73 */
74 public function setId(Id $id)
75 {
76 $this->id = $id;
77 }
78
79 /**
80 * @return IntegerValue
81 */
82 public function getDayIndex()
83 {
84 return $this->dayIndex;
85 }
86
87 /**
88 * @param IntegerValue $dayIndex
89 */
90 public function setDayIndex(IntegerValue $dayIndex)
91 {
92 $this->dayIndex = $dayIndex;
93 }
94
95 /**
96 * @return DateTimeValue
97 */
98 public function getStartTime()
99 {
100 return $this->startTime;
101 }
102
103 /**
104 * @param DateTimeValue $startTime
105 */
106 public function setStartTime(DateTimeValue $startTime)
107 {
108 $this->startTime = $startTime;
109 }
110
111 /**
112 * @return DateTimeValue
113 */
114 public function getEndTime()
115 {
116 return $this->endTime;
117 }
118
119 /**
120 * @param DateTimeValue $endTime
121 */
122 public function setEndTime(DateTimeValue $endTime)
123 {
124 $this->endTime = $endTime;
125 }
126
127 /**
128 * @return Collection
129 */
130 public function getTimeOutList()
131 {
132 return $this->timeOutList;
133 }
134
135 /**
136 * @param Collection $timeOutList
137 */
138 public function setTimeOutList(Collection $timeOutList)
139 {
140 $this->timeOutList = $timeOutList;
141 }
142
143 /**
144 * @return Collection
145 */
146 public function getPeriodList()
147 {
148 return $this->periodList;
149 }
150
151 /**
152 * @param Collection $periodList
153 */
154 public function setPeriodList(Collection $periodList)
155 {
156 $this->periodList = $periodList;
157 }
158
159 /**
160 * @return array
161 */
162 public function toArray()
163 {
164 return [
165 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
166 'dayIndex' => $this->dayIndex->getValue(),
167 'startTime' => $this->startTime->getValue()->format('H:i:s'),
168 'endTime' => $this->endTime->getValue()->format('H:i:s') === '00:00:00' ?
169 '24:00:00' : $this->endTime->getValue()->format('H:i:s'),
170 'timeOutList' => $this->timeOutList->toArray(),
171 'periodList' => $this->periodList->toArray(),
172 ];
173 }
174 }
175