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

Method getOwnFavoriteReports

lib/Service/ReportService.php:372–386  ·  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

370 * @throws Exception
371 */
372 public function getOwnFavoriteReports() {
373 $ownReports = $this->ReportMapper->index();
374 $sharedReports = $this->ShareService->getSharedItems(ShareService::SHARE_ITEM_TYPE_REPORT);
375 $favorites = $this->tagManager->load('analytics')->getFavorites();
376
377 // remove the favorite if the report is not existing anymore
378 foreach ($favorites as $favorite) {
379 if (!in_array($favorite, array_column($ownReports, 'id')) && !in_array($favorite, array_column($sharedReports, 'id'))) {
380 unset($favorites[$favorite]);
381 $this->removeFavoriteTag('analytics', $favorite);
382 }
383 }
384
385 return $favorites;
386 }
387
388 /**
389 * set/remove the favorite flag for a report

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected