AppleCalendarFactory.php
29 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Domain\Factory\Apple; |
| 4 | |
| 5 | use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException; |
| 6 | use AmeliaBooking\Domain\Entity\User\AppleCalendarEmployeeConnect; |
| 7 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 8 | |
| 9 | class AppleCalendarFactory |
| 10 | { |
| 11 | /** |
| 12 | * @throws InvalidArgumentException |
| 13 | */ |
| 14 | public static function create($data) |
| 15 | { |
| 16 | $appleCalendarConnect = new AppleCalendarEmployeeConnect(); |
| 17 | |
| 18 | if (isset($data['iCloudId'])) { |
| 19 | $appleCalendarConnect->setICloudId(new Name($data['iCloudId'])); |
| 20 | } |
| 21 | |
| 22 | if (isset($data['appSpecificPassword'])) { |
| 23 | $appleCalendarConnect->setAppSpecificPassword(new Name($data['appSpecificPassword'])); |
| 24 | } |
| 25 | |
| 26 | return $appleCalendarConnect; |
| 27 | } |
| 28 | } |
| 29 |