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

Method getOwnFavoriteReports

lib/Service/PanoramaService.php:277–291  ·  view source on GitHub ↗

* get own reports which are marked as favorites * * @return array|bool * @throws Exception */

()

Source from the content-addressed store, hash-verified

275 * @throws Exception
276 */
277 public function getOwnFavoriteReports() {
278 $ownReports = $this->PanoramaMapper->index();
279 //$sharedReports = $this->ShareService->getSharedItems(ShareService::SHARE_ITEM_TYPE_REPORT);
280 $sharedReports = [];
281 $favorites = $this->tagManager->load('analyticsPanorama')->getFavorites();
282
283 // remove the favorite if the report is not existing anymore
284 foreach ($favorites as $favorite) {
285 if (!in_array($favorite, array_column($ownReports, 'id')) && !in_array($favorite, array_column($sharedReports, 'id'))) {
286 unset($favorites[$favorite]);
287 $this->removeFavoriteTag('analyticsPanorama', $favorite);
288 }
289 }
290 return $favorites;
291 }
292
293 /**
294 * set/remove the favorite flag for a report

Callers

nothing calls this directly

Calls 4

removeFavoriteTagMethod · 0.95
getFavoritesMethod · 0.80
indexMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected