ZoomFactory.php
42 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Domain\Factory\Zoom; |
| 4 | |
| 5 | use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException; |
| 6 | use AmeliaBooking\Domain\Entity\Zoom\ZoomMeeting; |
| 7 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 8 | use AmeliaBooking\Domain\ValueObjects\String\Url; |
| 9 | |
| 10 | /** |
| 11 | * Class ZoomFactory |
| 12 | * |
| 13 | * @package AmeliaBooking\Domain\Factory\Zoom |
| 14 | */ |
| 15 | class ZoomFactory |
| 16 | { |
| 17 | /** |
| 18 | * @param $data |
| 19 | * |
| 20 | * @return ZoomMeeting |
| 21 | * @throws InvalidArgumentException |
| 22 | */ |
| 23 | public static function create($data) |
| 24 | { |
| 25 | $zoomMeeting = new ZoomMeeting(); |
| 26 | |
| 27 | if (isset($data['id'])) { |
| 28 | $zoomMeeting->setId(new Id($data['id'])); |
| 29 | } |
| 30 | |
| 31 | if (isset($data['joinUrl'])) { |
| 32 | $zoomMeeting->setJoinUrl(new Url($data['joinUrl'])); |
| 33 | } |
| 34 | |
| 35 | if (isset($data['startUrl'])) { |
| 36 | $zoomMeeting->setStartUrl(new Url($data['startUrl'])); |
| 37 | } |
| 38 | |
| 39 | return $zoomMeeting; |
| 40 | } |
| 41 | } |
| 42 |