PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
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 / DayOff.php
ameliabooking / src / Domain / Entity / Schedule Last commit date
DayOff.php 5 years ago Period.php 3 years ago PeriodLocation.php 3 years ago PeriodService.php 6 years ago SpecialDay.php 6 years ago SpecialDayPeriod.php 3 years ago SpecialDayPeriodLocation.php 3 years ago SpecialDayPeriodService.php 6 years ago TimeOut.php 6 years ago WeekDay.php 6 years ago
DayOff.php
150 lines
1 <?php
2 /**
3 * @copyright © TMS-Plugins. All rights reserved.
4 * @licence See LICENCE.md for license details.
5 */
6
7 namespace AmeliaBooking\Domain\Entity\Schedule;
8
9 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
10 use AmeliaBooking\Domain\ValueObjects\DateTime\DateTimeValue;
11 use AmeliaBooking\Domain\ValueObjects\Number\Integer\DateRepeat;
12 use AmeliaBooking\Domain\ValueObjects\String\Name;
13
14 /**
15 * Class DayOff
16 *
17 * @package AmeliaBooking\Domain\Entity\Schedule
18 */
19 class DayOff
20 {
21 /** @var Id */
22 private $id;
23
24 /** @var Name */
25 private $name;
26
27 /** @var DateTimeValue */
28 private $startDate;
29
30 /** @var DateTimeValue */
31 private $endDate;
32
33 /** @var DateRepeat */
34 private $repeat;
35
36 /**
37 * DayOff constructor.
38 *
39 * @param Name $name
40 * @param DateTimeValue $startDate
41 * @param DateTimeValue $endDate
42 * @param DateRepeat $repeat
43 */
44 public function __construct(
45 Name $name,
46 DateTimeValue $startDate,
47 DateTimeValue $endDate,
48 DateRepeat $repeat
49 ) {
50 $this->name = $name;
51 $this->startDate = $startDate;
52 $this->endDate = $endDate;
53 $this->repeat = $repeat;
54 }
55
56 /**
57 * @return Id
58 */
59 public function getId()
60 {
61 return $this->id;
62 }
63
64 /**
65 * @param Id $id
66 */
67 public function setId(Id $id)
68 {
69 $this->id = $id;
70 }
71
72 /**
73 * @return DateTimeValue
74 */
75 public function getStartDate()
76 {
77 return $this->startDate;
78 }
79
80 /**
81 * @param DateTimeValue $startDate
82 */
83 public function setStartDate(DateTimeValue $startDate)
84 {
85 $this->startDate = $startDate;
86 }
87
88 /**
89 * @return DateTimeValue
90 */
91 public function getEndDate()
92 {
93 return $this->endDate;
94 }
95
96 /**
97 * @param DateTimeValue $endDate
98 */
99 public function setEndDate(DateTimeValue $endDate)
100 {
101 $this->endDate = $endDate;
102 }
103
104 /**
105 * @return DateRepeat
106 */
107 public function getRepeat()
108 {
109 return $this->repeat;
110 }
111
112 /**
113 * @param DateRepeat $repeat
114 */
115 public function setRepeat(DateRepeat $repeat)
116 {
117 $this->repeat = $repeat;
118 }
119
120 /**
121 * @return Name
122 */
123 public function getName()
124 {
125 return $this->name;
126 }
127
128 /**
129 * @param Name $name
130 */
131 public function setName(Name $name)
132 {
133 $this->name = $name;
134 }
135
136 /**
137 * @return array
138 */
139 public function toArray()
140 {
141 return [
142 'id' => null !== $this->id ? $this->id->getValue() : null,
143 'name' => $this->name->getValue(),
144 'startDate' => $this->startDate->getValue()->format('Y-m-d'),
145 'endDate' => $this->endDate->getValue()->format('Y-m-d'),
146 'repeat' => $this->repeat->getValue(),
147 ];
148 }
149 }
150