25 $this->sectionDM = $sectionDM;
34 ->
setId($this->getId())
35 ->setName($this->getName())
36 ->setColor($this->getColor())
37 ->setGoogleId($this->getGoogleId())
38 ->setSyncToken($this->getSyncToken())
39 ->setPageToken($this->getPageToken())
40 ->setCalDavConnectionId($this->getCalDavConnectionId())
41 ->setDescription($this->getDescription())
42 ->setExternalType($this->getExternalType())
43 ->setType($this->getType())
44 ->setIsActive($this->getIsActive())
45 ->setXmlId($this->getXmlId())
46 ->setOwner($this->getOwner())
47 ->setCreator($this->getCreator())
48 ->setIsCollab($this->getIsCollab())
55 private function getId(): int
57 return $this->sectionDM->getId();
63 private function getGoogleId(): ?string
65 return $this->sectionDM->getGapiCalendarId();
71 private function getSyncToken(): ?string
73 return $this->sectionDM->getSyncToken();
79 private function getPageToken(): ?string
81 return $this->sectionDM->getPageToken();
87 private function getCalDavConnectionId(): ?int
89 return (
int)$this->sectionDM->getCalDavCon() ?:
null;
95 private function getDescription(): ?string
97 return $this->sectionDM->getDescription();
103 private function getName(): ?string
105 return $this->sectionDM->getName();
111 private function getColor(): string
113 return $this->sectionDM->getColor();
119 private function getExternalType(): string
121 return $this->sectionDM->getExternalType();
127 private function getIsActive(): bool
129 return $this->sectionDM->getActive();
135 private function getType(): string
137 return $this->sectionDM->getCalType();
143 private function getXmlId(): string
145 return $this->sectionDM->getXmlId();
153 private function getOwner(): ?Role
155 if ($id = $this->sectionDM->getOwnerId())
159 return match ($this->sectionDM->getCalType())
161 Dictionary::CALENDAR_TYPE[
'group'] => Helper::getGroupRole($id),
162 Dictionary::CALENDAR_TYPE[
'company'] => Helper::getCompanyRole($id),
163 default => Helper::getUserRole($id),
166 catch (BaseException $e)
180 private function getCreator(): ?Role
182 if ($id = ($this->sectionDM->getCreatedBy() ?? $this->sectionDM->getOwnerId()))
186 return Helper::getUserRole($id);
188 catch (BaseException $e)
197 private function getIsCollab(): bool
199 if ($this->getType() !== Dictionary::CALENDAR_TYPE[
'group'])
204 $groupId = $this->getOwner()?->getId();
210 return (
bool)Collab\Collabs::getInstance()->getCollabIfExists($groupId);