static function get() { // This object is a singleton if (!isset(PartuzaDbFetcher::$fetcher)) { PartuzaDbFetcher::$fetcher = new PartuzaDbFetcher(); } return PartuzaDbFetcher::$fetcher; }
/** * Get the set of user id's from a user or collection of users, and group */ private function getIdSet($user, GroupId $group, SecurityToken $token) { $ids = array(); if ($user instanceof UserId) { $userId = $user->getUserId($token); if ($group == null) { return array($userId); } switch ($group->getType()) { case 'all': case 'friends': case 'groupId': $friendIds = PartuzaDbFetcher::get()->getFriendIds($userId); if (is_array($friendIds) && count($friendIds)) { $ids = $friendIds; } break; case 'self': $ids[] = $userId; break; } } elseif (is_array($user)) { $ids = array(); foreach ($user as $id) { $ids = array_merge($ids, $this->getIdSet($id, $group, $token)); } } return $ids; }