22 $this->linkParts = $linkParts;
23 $this->user =
new User($this->linkParts->userId);
25 $parts = $this->getParts();
27 $baseLink = match ($this->type)
29 LinkType::Tasks, LinkType::Calendar,
LinkType::Disk, => implode(
'/', $parts) .
'/',
32 if ($this->linkParts->entityId ===
null)
37 return $this->getEntityLink($baseLink);
40 private function getEntityLink(
string $baseLink): string
42 $parts = $this->getEntityParts();
44 return match ($this->type)
46 LinkType::Tasks => $baseLink . implode(
'/', $parts) .
'/',
51 private function getParts():
array
53 $sitePart = $this->getSitePart();
56 return [$this->getCollabPart(), $this->getEntityPart()];
59 return [$this->getSitePart(), $this->getCollabPart(), $this->getEntityPart()];
62 private function getEntityParts():
array
64 if (empty($this->linkParts->view))
66 return [$this->linkParts->entityId];
69 $entityType = $this->getEntityType();
70 if (empty($entityType))
72 return [$this->linkParts->view, $this->linkParts->entityId];
75 return [$entityType, $this->linkParts->view, $this->linkParts->entityId];
78 private function getSitePart(): string
80 if ($this->user->isExtranet())
88 private function getCollabPart(): string
90 return 'workgroups/group/' . $this->linkParts->collabId;
93 private function getEntityPart(): string
95 return match ($this->type)
97 LinkType::Tasks =>
'tasks',
98 LinkType::Calendar =>
'calendar',
103 private function getEntityType(): string
105 return match ($this->type)
107 LinkType::Tasks =>
'task',