public function testCaseInsensitivity() { SteamGroup::clearCache(); $group = SteamGroup::create('valve', false); $group2 = SteamGroup::create('Valve', false); $group3 = SteamGroup::create('VALVE', false, true); $this->assertTrue(SteamGroup::isCached('valve')); $this->assertEquals($group, $group2); $this->assertEquals($group, $group3); }
/** * Fetchs data from the Steam Community by querying the XML version of the * profile specified by the ID of this Steam ID * * @throws SteamCondenserException if the Steam ID data is not available, * e.g. when it is private, or when it cannot be parsed */ public function fetchData() { $profile = $this->getData($this->getBaseUrl() . '?xml=1'); if (!empty($profile->error)) { throw new SteamCondenserException((string) $profile->error); } if (!empty($profile->privacyMessage)) { throw new SteamCondenserException((string) $profile->privacyMessage); } $this->nickname = htmlspecialchars_decode((string) $profile->steamID); $this->steamId64 = (string) $profile->steamID64; $this->limited = (bool) (int) $profile->isLimitedAccount; $this->tradeBanState = (string) $profile->tradeBanState; $this->vacBanned = (bool) (int) $profile->vacBanned; $this->imageUrl = substr((string) $profile->avatarIcon, 0, -4); $this->onlineState = (string) $profile->onlineState; $this->privacyState = (string) $profile->privacyState; $this->stateMessage = (string) $profile->stateMessage; $this->visibilityState = (int) $profile->visibilityState; if ($this->isPublic()) { $this->customUrl = strtolower((string) $profile->customURL); $this->headLine = htmlspecialchars_decode((string) $profile->headline); $this->hoursPlayed = (double) $profile->hoursPlayed2Wk; $this->location = (string) $profile->location; $this->memberSince = (string) $profile->memberSince; $this->realName = htmlspecialchars_decode((string) $profile->realname); $this->steamRating = (double) $profile->steamRating; $this->summary = htmlspecialchars_decode((string) $profile->summary); } if (!empty($profile->mostPlayedGames)) { foreach ($profile->mostPlayedGames->mostPlayedGame as $mostPlayedGame) { $this->mostPlayedGames[(string) $mostPlayedGame->gameName] = (double) $mostPlayedGame->hoursPlayed; } } if (!empty($profile->groups)) { foreach ($profile->groups->group as $group) { $this->groups[] = SteamGroup::create((string) $group->groupID64, false); } } if (!empty($profile->weblinks)) { foreach ($profile->weblinks->weblink as $link) { $this->links[htmlspecialchars_decode((string) $link->title)] = (string) $link->link; } } $this->fetchTime = time(); }
/** * Fetchs data from the Steam Community by querying the XML version of the * profile specified by the ID of this SteamID */ public function fetchData() { $url = $this->getBaseUrl() . "?xml=1"; $profile = new SimpleXMLElement(file_get_contents($url)); if (!empty($profile->error)) { throw new SteamCondenserException((string) $profile->error); } $this->nickname = (string) $profile->steamID; $this->steamId64 = (string) $profile->steamID64; $this->vacBanned = (bool) $profile->vacBanned; if (!empty($profile->privacyMessage)) { throw new SteamCondenserException((string) $profile->privacyMessage); } $this->imageUrl = substr((string) $profile->avatarIcon, 0, -4); $this->onlineState = (string) $profile->onlineState; $this->privacyState = (string) $profile->privacyState; $this->stateMessage = (string) $profile->stateMessage; $this->visibilityState = (int) $profile->visibilityState; if ($this->privacyState == "public") { $this->customUrl = strtolower((string) $profile->customURL); $this->favoriteGame = (string) $profile->favoriteGame->name; $this->favoriteGameHoursPlayed = (string) $profile->favoriteGame->hoursPlayed2wk; $this->headLine = (string) $profile->headline; $this->hoursPlayed = (double) $profile->hoursPlayed2Wk; $this->location = (string) $profile->location; $this->memberSince = (string) $profile->memberSince; $this->realName = (string) $profile->realname; $this->steamRating = (double) $profile->steamRating; $this->summary = (string) $profile->summary; } if (!empty($profile->mostPlayedGames)) { foreach ($profile->mostPlayedGames->mostPlayedGame as $mostPlayedGame) { $this->mostPlayedGames[(string) $mostPlayedGame->gameName] = (double) $mostPlayedGame->hoursPlayed; } } if (!empty($profile->groups)) { foreach ($profile->groups->group as $group) { $this->groups[] = SteamGroup::create((string) $group->groupID64, false); } } if (!empty($profile->weblinks)) { foreach ($profile->weblinks->weblink as $link) { $this->links[(string) $link->title] = (string) $link->link; } } $this->fetchTime = time(); }