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);
 }
 public function testBaseUrlCustomUrl()
 {
     $group = new SteamGroup('valve', false);
     $this->assertEquals('valve', $group->getCustomUrl());
     $this->assertEquals('http://steamcommunity.com/groups/valve', $group->getBaseUrl());
 }
 /**
  * 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();
 }
 /**
  * Clears the group cache
  */
 public static function clearCache()
 {
     self::$steamGroups = array();
 }
        }
        $this->memberCount = (int) $memberData->memberCount;
        $totalPages = (int) $memberData->totalPages;
        foreach ($memberData->members->steamID64 as $member) {
            array_push($this->members, SteamId::create((string) $member, false));
        }
        return $totalPages;
    }
    /**
     * Loads information about and members of this group
     *
     * This includes the ID, name, headline, summary and avatar and custom URL.
     *
     * This might take several HTTP requests as the Steam Community splits this
     * data over several XML documents if the group has lots of members.
     */
    protected function internalFetch()
    {
        if (empty($this->memberCount) || sizeof($this->members) == $this->memberCount) {
            $page = 0;
        } else {
            $page = 1;
        }
        do {
            $totalPages = $this->fetchPage(++$page);
        } while ($page < $totalPages);
        $this->fetchTime = time();
    }
}
SteamGroup::initialize();
 public function testGroupByGroupId64()
 {
     $group = new SteamGroup('103582791429521412');
     print_r($group->getMemberCount());
 }