GoogleCalendar.php
99 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Domain\Entity\Google; |
| 4 | |
| 5 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 6 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 7 | use AmeliaBooking\Domain\ValueObjects\String\Token; |
| 8 | |
| 9 | /** |
| 10 | * Class GoogleCalendar |
| 11 | * |
| 12 | * @package AmeliaBooking\Domain\Entity\Google |
| 13 | */ |
| 14 | class GoogleCalendar |
| 15 | { |
| 16 | /** @var Id */ |
| 17 | private $id; |
| 18 | |
| 19 | /** @var Token */ |
| 20 | private $token; |
| 21 | |
| 22 | /** @var Name */ |
| 23 | private $calendarId; |
| 24 | |
| 25 | /** |
| 26 | * GoogleCalendar constructor. |
| 27 | * |
| 28 | * @param Token $token |
| 29 | * @param Name $calendarId |
| 30 | */ |
| 31 | public function __construct( |
| 32 | Token $token, |
| 33 | Name $calendarId |
| 34 | ) { |
| 35 | $this->token = $token; |
| 36 | $this->calendarId = $calendarId; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @return Id |
| 41 | */ |
| 42 | public function getId() |
| 43 | { |
| 44 | return $this->id; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * @param Id $id |
| 49 | */ |
| 50 | public function setId($id) |
| 51 | { |
| 52 | $this->id = $id; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * @return Token |
| 57 | */ |
| 58 | public function getToken() |
| 59 | { |
| 60 | return $this->token; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * @param Token $token |
| 65 | */ |
| 66 | public function setToken($token) |
| 67 | { |
| 68 | $this->token = $token; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @return Name |
| 73 | */ |
| 74 | public function getCalendarId() |
| 75 | { |
| 76 | return $this->calendarId; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * @param Name $calendarId |
| 81 | */ |
| 82 | public function setCalendarId($calendarId) |
| 83 | { |
| 84 | $this->calendarId = $calendarId; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @return array |
| 89 | */ |
| 90 | public function toArray() |
| 91 | { |
| 92 | return [ |
| 93 | 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, |
| 94 | 'token' => $this->getToken()->getValue(), |
| 95 | 'calendarId' => null !== $this->getCalendarId() ? $this->getCalendarId()->getValue() : null, |
| 96 | ]; |
| 97 | } |
| 98 | } |
| 99 |