public function format(Community $community) { $isOwn = false; if ($this->currentAccountService->isAvailable()) { $isOwn = $this->currentAccountService->getCurrentAccount()->equals($community->getOwner()); } return ['community' => $community->toJSON(), 'collections' => $this->formatCollections($community->getCollections()), 'is_own' => $isOwn]; }
public function format(Profile $profile) : array { return ['profile' => $profile->toJSON(), 'collections' => $this->formatCollections($profile->getCollections()), 'bookmarks' => array_map(function (ProfileCommunityEQ $eq) { return $eq->toJSON(); }, $this->communityBookmarksService->getBookmarksOfProfile($profile->getId())), 'is_own' => $this->currentAccountService->isAvailable() ? $this->currentAccountService->getCurrentAccount()->getProfiles()->contains($profile) : false]; }