PluginProbe
Booking for Appointments and Events Calendar – Amelia / 2.4.1
Booking for Appointments and Events Calendar – Amelia v2.4.1
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 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 All 59 releases
ameliabooking / src / Domain / Factory / Schedule / TimeOutFactory.php
TimeOutFactory.php
32 lines 825 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AmeliaBooking\Domain\Factory\Schedule;
4
5 use AmeliaBooking\Domain\Entity\Schedule\TimeOut;
6 use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException;
7 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
8 use AmeliaBooking\Domain\ValueObjects\DateTime\DateTimeValue;
9
10 class TimeOutFactory
11 {
12 /**
13 * @param array $data
14 *
15 * @return TimeOut
16 * @throws InvalidArgumentException
17 */
18 public static function create($data)
19 {
20 $timeOut = new TimeOut(
21 new DateTimeValue(\DateTime::createFromFormat('H:i:s', $data['startTime'])),
22 new DateTimeValue(\DateTime::createFromFormat('H:i:s', $data['endTime']))
23 );
24
25 if (isset($data['id'])) {
26 $timeOut->setId(new Id($data['id']));
27 }
28
29 return $timeOut;
30 }
31 }
32