PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.1
Booking for Appointments and Events Calendar – Amelia v2.1
2.4.4 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 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