/** * Given a person, this returns formatted information about the activities of the person * @param PersonEntity $person * @return array */ public static function getFormattedActivitiesOfPerson($person) { /** @var PersonEntity $person */ $activities = $person->getActivities(); $ret = []; foreach ($activities as $activity) { if (!$activity->isHidden()) { $ret[] = Activity::getFormattedShortData($activity); } } return $ret; }
/** * @param ActivityEntity[] $activities * @param $page * @return mixed */ public static function getFormattedActivities($activities, $page) { $response['error'] = null; $response['count'] = count($activities); for ($i = 10 * ($page - 1); $i < min($response['count'], $page * 10); $i++) { $activity = $activities[$i]; $response['activities'][] = Activity::getFormattedShortData($activity); } return $response; }