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

Method getOwnFavoriteReports

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

400 * @throws Exception
401 */
402 public function getOwnFavoriteReports() {
403 $ownReports = $this->ReportMapper->index();
404 $sharedReports = $this->ShareService->getSharedItems(ShareService::SHARE_ITEM_TYPE_REPORT);
405 $favorites = $this->tagManager->load('analytics')->getFavorites();
406
407 // remove the favorite if the report is not existing anymore
408 foreach ($favorites as $favorite) {
409 if (!in_array($favorite, array_column($ownReports, 'id')) && !in_array($favorite, array_column($sharedReports, 'id'))) {
410 unset($favorites[$favorite]);
411 $this->removeFavoriteTag('analytics', $favorite);
412 }
413 }
414
415 return $favorites;
416 }
417
418 /**
419 * 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