id = $id; $this->eventId = $eventId; $this->googleId = $googleId; $this->isFromGoogle = $isFromGoogle; $this->eventDate = $eventDate; $this->owner = $owner; $this->htmlLink = $htmlLink; } /** * @return string */ public function getEventDateAsString(): string { if ($this->eventDate === null) { return ''; } return $this->eventDate->format('Y-m-d H:i:s'); } /** * @param array $data * * @return GoogleCalenderSyncValue */ public static function fromDbState(array $data): GoogleCalenderSyncValue { $instance = new self( $data['id'], $data['event_id'], $data['foreign_id'], $data['owner'], $data['from_google'] === 1, null, $data['html_link'] ); if ($data['event_date'] !== null) { $instance->setEventDate(DateTime::createFromFormat('Y-m-d H:i:s', $data['event_date'])); } return $instance; } /** * @return int */ public function getId(): int { return $this->id; } /** * @param int $id * * @return void */ public function setId(int $id): void { $this->id = $id; } /** * @return int */ public function getEventId(): int { return $this->eventId; } /** * @param int $eventId * * @return void */ public function setEventId(int $eventId): void { $this->eventId = $eventId; } /** * @return string */ public function getGoogleId(): string { if ($this->googleId === null) { return ''; } return $this->googleId; } /** * @param string $googleId * * @return void */ public function setGoogleId(string $googleId): void { $this->googleId = $googleId; } /** * @return bool */ public function isFromGoogle(): bool { return $this->isFromGoogle; } /** * @param bool $isFromGoogle * * @return void */ public function setIsFromGoogle(bool $isFromGoogle): void { $this->isFromGoogle = $isFromGoogle; } /** * @return DateTimeInterface|null */ public function getEventDate(): ?DateTimeInterface { return $this->eventDate; } /** * @param DateTimeInterface $eventDate * * @return void */ public function setEventDate(DateTimeInterface $eventDate): void { $this->eventDate = $eventDate; } /** * @return int */ public function getOwner(): int { return $this->owner; } /** * @param int $owner * * @return void */ public function setOwner(int $owner): void { $this->owner = $owner; } /** * @return string */ public function getHtmlLink(): string { if ($this->htmlLink === null) { return ''; } return $this->htmlLink; } /** * @param string $htmlLink * * @return void */ public function setHtmlLink(string $htmlLink): void { $this->htmlLink = $htmlLink; } }