MCPcopy Create free account
hub / github.com/Rello/analytics / search

Method search

lib/Search/SearchProvider.php:54–88  ·  view source on GitHub ↗
(IUser $user, ISearchQuery $query)

Source from the content-addressed store, hash-verified

52 }
53
54 public function search(IUser $user, ISearchQuery $query): SearchResult
55 {
56 if (!$this->appManager->isEnabledForUser('analytics', $user)) {
57 return SearchResult::complete($this->getName(), []);
58 }
59
60 $reports = $this->ReportService->search($query->getTerm());
61 $panoramas = $this->PanoramaService->search($query->getTerm());
62 $result = [];
63
64 foreach ($reports as $report) {
65 $result[] = new SearchResultEntry(
66 $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', 'report.svg')),
67 $report['name'],
68 '',
69 $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute('analytics.page.report', ['id' => $report['id']])),
70 ''
71 );
72 }
73
74 foreach ($panoramas as $panorama) {
75 $result[] = new SearchResultEntry(
76 $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', 'panorama.svg')),
77 $panorama['name'],
78 '',
79 $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute('analytics.page.panorama', ['id' => $panorama['id']])),
80 ''
81 );
82 }
83
84 return SearchResult::complete(
85 $this->l10n->t('Analytics'),
86 $result
87 );
88 }
89
90 public function getName(): string
91 {

Callers

nothing calls this directly

Calls 5

getNameMethod · 0.95
isEnabledForUserMethod · 0.45
getAbsoluteURLMethod · 0.45
imagePathMethod · 0.45
tMethod · 0.45

Tested by

no test coverage detected