(string $referenceText)
| 89 | } |
| 90 | |
| 91 | public function resolveReference(string $referenceText): ?IReference |
| 92 | { |
| 93 | if ($this->matchReference($referenceText)) { |
| 94 | preg_match("/\d+$/", $referenceText, $matches); // get the last integer |
| 95 | $isPanorama = str_contains($referenceText, '/pa/'); |
| 96 | if ($isPanorama) { |
| 97 | $item = $this->PanoramaService->read((int)$matches[0]); |
| 98 | $icon = 'panorama.svg'; |
| 99 | $type = $this->l10n->t('Panorama'); |
| 100 | } else { |
| 101 | $item = $this->ReportService->read((int)$matches[0]); |
| 102 | $icon = 'report.svg'; |
| 103 | $type = $this->l10n->t('Report'); |
| 104 | } |
| 105 | if (!empty($item)) { |
| 106 | $imageUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', $icon)); |
| 107 | $name = $this->l10n->t('Analytics') . ' ' . $type; |
| 108 | $subheader = $item['name']; |
| 109 | } else { |
| 110 | $imageUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', 'noReport.svg')); |
| 111 | $name = $this->l10n->t('Report not found'); |
| 112 | $subheader = $this->l10n->t('This report was removed or is not shared with you'); |
| 113 | } |
| 114 | $reference = new Reference($referenceText); |
| 115 | $reference->setTitle($name); |
| 116 | $reference->setDescription($subheader); |
| 117 | $reference->setImageUrl($imageUrl); |
| 118 | $reference->setRichObject( |
| 119 | self::RICH_OBJECT_TYPE, |
| 120 | [ |
| 121 | 'name' => $name, |
| 122 | 'subheader' => $subheader, |
| 123 | 'url' => $referenceText, |
| 124 | 'image' => $imageUrl |
| 125 | ] |
| 126 | ); |
| 127 | return $reference; |
| 128 | } |
| 129 | return null; |
| 130 | } |
| 131 | |
| 132 | public function getCachePrefix(string $referenceId): string |
| 133 | { |
nothing calls this directly
no test coverage detected