/** * Returns an array containing all of this game's leaderboards * * @return array The leaderboards for this game */ public function getLeaderboards() { return GameLeaderboard::getLeaderboards($this->appId); }
/** * Loads the leaderboards of the specified games into the cache * * @param string $gameName The short name of the game * @throws SteamCondenserException if an error occurs while fetching the * leaderboards */ private static function loadLeaderboards($gameName) { $url = "http://steamcommunity.com/stats/{$gameName}/leaderboards/?xml=1"; $boardsData = new \SimpleXMLElement(file_get_contents($url)); if (!empty($boardsData->error)) { throw new SteamCondenserException((string) $boardsData->error); } self::$leaderboards[$gameName] = []; foreach ($boardsData->leaderboard as $boardData) { $leaderboard = new GameLeaderboard($boardData); self::$leaderboards[$gameName][$leaderboard->getId()] = $leaderboard; } }
/** * Returns an array containing all of this game's leaderboards * * @return array The leaderboards for this game */ public function getLeaderboards() { return GameLeaderboard::getLeaderboards($this->shortName); }