/** * Creates a stats object for the given user and this game * * @param string $steamId The custom URL or the 64bit Steam ID of the user * @return GameStats The stats of this game for the given user */ public function getUserStats($steamId) { if (!$this->hasStats()) { return null; } return GameStats::createGameStats($steamId, $this->shortName); }
/** * Returns the stats for the given game for the owner of this SteamID * * @param mixed $id The full or short name or the application ID of the * game stats should be fetched for * @return GameStats The statistics for the game with the given name * @throws SteamCondenserException if the user does not own this game or it * does not have any stats */ public function getGameStats($id) { $game = $this->findGame($id); if (!$game->hasStats()) { throw new SteamCondenserException("\"{$game->getName()}\" does not have stats."); } if (empty($this->customUrl)) { return GameStats::createGameStats($this->steamId64, $game->getShortName()); } else { return GameStats::createGameStats($this->customUrl, $game->getShortName()); } }
/** * Returns a GameStats object for the given game for the owner of this SteamID * * @param $gameName * @return GameStats */ public function getGameStats($gameName) { if (in_array($gameName, array_values($this->getGames()))) { $friendlyName = $gameName; } else { if (array_key_exists(strtolower($gameName), $this->getGames())) { $friendlyName = $this->games[strtolower($gameName)]; } else { throw new SteamCondenserException("Stats for game {$gameName} do not exist."); } } if (empty($this->customUrl)) { return GameStats::createGameStats($this->steamId64, $friendlyName); } else { return GameStats::createGameStats($this->customUrl, $friendlyName); } }