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

Method search

lib/Search/SearchProvider.php:54–94  ·  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 $url = $this->urlGenerator->linkToRouteAbsolute('analytics.page.report', ['id' => $report['id']]);
66 foreach ($this->getReportModes($report) as $mode => $label) {
67 $result[] = new SearchResultEntry(
68 $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', 'report.svg')),
69 $report['name'],
70 $label,
71 $url . ($mode === '' ? '' : '/' . $mode),
72 ''
73 );
74 }
75 }
76
77 foreach ($panoramas as $panorama) {
78 $url = $this->urlGenerator->linkToRouteAbsolute('analytics.page.panorama', ['id' => $panorama['id']]);
79 foreach ($this->getPanoramaModes() as $mode => $label) {
80 $result[] = new SearchResultEntry(
81 $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', 'panorama.svg')),
82 $panorama['name'],
83 $label,
84 $url . ($mode === '' ? '' : '/' . $mode),
85 ''
86 );
87 }
88 }
89
90 return SearchResult::complete(
91 $this->l10n->t('Analytics'),
92 $result
93 );
94 }
95
96 public function getName(): string
97 {

Callers

nothing calls this directly

Calls 10

getNameMethod · 0.95
getReportModesMethod · 0.95
getPanoramaModesMethod · 0.95
completeMethod · 0.80
getTermMethod · 0.80
isEnabledForUserMethod · 0.45
linkToRouteAbsoluteMethod · 0.45
getAbsoluteURLMethod · 0.45
imagePathMethod · 0.45
tMethod · 0.45

Tested by

no test coverage detected