/** * Get all event entries */ public function getAllEntries() { try { $response = $this->client->getEvents(['group_urlname' => $this->groupName]); } catch (ClientErrorResponseException $e) { return array(); } return array_map(array($this, 'createEntity'), $response->getData()); }
/** * Fetch all events in the past and up to a day in the future. * * @return array */ public function getEvents() { $cached = $this->getFromCache('events_cache'); if ($cached !== null) { return $cached; } // Fetch past and future events (only upcoming contains the current event) $events = $this->client->getEvents(array('group_urlname' => $this->group, 'status' => 'past,upcoming', 'desc' => 'desc')); // Filter out events further in the future than a day $dayFromNow = (time() + 24 * 60 * 60) * 1000; $events = $events->filter(function ($value) use($dayFromNow) { return $value['time'] < $dayFromNow ? true : false; }); $this->saveInCache('events_cache', $events); return $events; }