Converts Steam ID to Community ID
Example input: STEAM_0:0:17336203 or 0:0:17336203
@param string $steam_id Full or short Steam ID
@return string Community ID
@throws WrongIDException
169669
public function steamIdToCommunityId($steam_id)
    {
        $x = NULL;
        $y = NULL;
        if (preg_match('/(?i:STEAM)_0:[0-9]:[0-9]*/', $steam_id)) {
            $x = substr($steam_id, 8, 1);
            $y = substr($steam_id, 10);
        } elseif (preg_match('/0:[0-9]:[0-9]*/', $steam_id)) {
            $x = substr($steam_id, 2, 1);
            $y = substr($steam_id, 4);
        } else {
            throw new WrongIDException($steam_id);
        }
        return ($y * 2) + $x + 76561197960265728;
    }
178736
public function parseInfo(): void
    {
        if (is_null($this->steamId)) {
            return;
        }

        if (empty(Config::get('steam-auth.api_key'))) {
            throw new RuntimeException('The Steam API key has not been specified.');
        }

        $response = $this->guzzleClient->request(
            'GET',
            sprintf(self::STEAM_INFO_URL, Config::get('steam-auth.api_key'), $this->steamId)
        );
        $json = json_decode($response->getBody(), true);

        $this->steamInfo = new SteamInfo($json['response']['players'][0]);
    }
174980
public function nextId()
    {
        $timestamp = time() - static::BASE_TIME;

        if ($this->lastTimestamp >= $timestamp) {
            $timestamp = $this->lastTimestamp;

            $sequence = ++ $this->sequence;

            if ($sequence > 0x7ff) {
                $this->lastTimestamp = ++ $timestamp;

                $sequence = $this->sequence = 0;
            }
        } else {
            $this->lastTimestamp = $timestamp;

            $sequence = $this->sequence = 0;
        }

        return ($timestamp << 32) | $this->mask | ($sequence & 0x7ff);
    }
21238
public function Auth()
    {
        if (!$this->OpenID->mode) {
            $this->OpenID->identity = $this->OpenIDURL;
            $this->OpenID->returnUrl = url('') . $_SERVER['REQUEST_URI'];
            $this->RedirectTo($this->OpenID->authUrl());
        } elseif ($this->OpenID->mode == 'cancel') {
            return false;
        } elseif ($this->OpenID->validate()) {
            $steamid64 = str_replace('http://steamcommunity.com/openid/id/', '', $this->OpenID->identity);

            if ($steamid64) {
                $url = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?';
                $query = http_build_query([
                        'key'      => Config::get('sgtaziz.steamauth.SteamAPIKey'),
                        'steamids' => $steamid64,
                    ]);

                $json = file_get_contents($url . $query);
                $json = json_decode($json, true);

                $user = $json['response']['players'][0];
                $user = json_decode(json_encode($user));

                return $user;
            }
        }

        return false;
    }
1060647
public static function sessionId($id = null)
    {
        if (PHP_SAPI != 'cli') {
            return $id ? session_id($id) : session_id();
        }
        if (static::sessionStarted() && HttpCache::$instance->sessionFile) {
            return str_replace('ses_', '', basename(HttpCache::$instance->sessionFile));
        }
        return '';
    }
826215
public function GetPlayerAchievementsV1($steamid, $appid, $l = null)
    {
        return $this->_call(__METHOD__, 'GET', array('steamid' => $steamid, 'appid' => $appid, 'l' => $l));
    }
635783
public function getHomeCountryId()
    {
        if ($this->_sHomeCountryId === null) {
            $this->_sHomeCountryId = false;
            $aHomeCountry = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aHomeCountry');
            if (is_array($aHomeCountry)) {
                $this->_sHomeCountryId = current($aHomeCountry);
            }
        }

        return $this->_sHomeCountryId;
    }
917346
public function getTorrentId()
  {
    if ($this->torrentId === null) {
      $this->torrentId = false;

      if (preg_match('~tid=([0-9]+)~', $this->torrentUrl, $match)) {
        $this->torrentId = intval($match[1]);
      }
    }

    return $this->torrentId;
  }
912259
public function getGuildMember4GuildId($id)
    {
        /** @var \GameBackend\Entity\SRO\Shard\Repository\GuildMember $repository */
        $repository = $this->getShardEntityManager()->getRepository($this->getGameOptions()->getEntityShardGuildMember());
        return $repository->getGuildMember4GuildId($id);
    }
1132924
protected function _extractId()
    {
		list(, $className) = namespaceSplit(get_class($this));
		$id = explode('Layout', $className)[0];

		if (!$className || !$id) {
			user_error(__d('wasabi_cms', 'The layout Class {0} has an invalid name. The name has to end with "Layout".', $className));
		}

		return $id;
	}
691009
public function getCommunityById($communityId)
    {
        if (!$this->apiVersionIsGreaterThanV3()) {
            throw new EndpointNotSupportedByApiVersionException();
        }

        if (!is_string($communityId)) {
            throw new InvalidTypeException('Community ID', 'string', gettype($communityId));
        }

        return $this->get(sprintf('communities/%s', $communityId));
    }
1258236
def remove(self, steamid):
        
        if isinstance(steamid, SteamUser):
            steamid = steamid.steam_id

        self._steam.send(MsgProto(EMsg.ClientRemoveFriend), {'friendid': steamid})
83981
public function getTypeOfId($id)
    {
        if (self::validateUserId($id, USER_ID_TYPE_COMMUNITY)) return USER_ID_TYPE_COMMUNITY;
        if (self::validateUserId($id, USER_ID_TYPE_STEAM)) return USER_ID_TYPE_STEAM;
        if (self::validateUserId($id, USER_ID_TYPE_VANITY)) return USER_ID_TYPE_VANITY;
        return FALSE;
    }
134917
public function lastInsertId(string $sequenceId = null): string
    {
        if ($sequenceId !== null) {
            return $this->connection()->lastInsertId($sequenceId);
        }

        return $this->connection()->lastInsertId();
    }
881768
public function convertToCompliantUuid($uuid=false){
        $id = ($uuid?$uuid:$this->uuid);
        $arr = [8, 13, 18, 23];
        foreach ($arr as $part){
            $id = substr_replace($id, '-', $part, 0);
        }
        return $id;
    }
106979
private function getRevisionId()
    {
        if (null === $this->revisionId) {
            $this->conn->insert(
                $this->config->getRevisionTableName(),
                [
                    'timestamp' => date_create('now'),
                    'username' => $this->config->getCurrentUsername(),
                ],
                [
                    Type::DATETIME,
                    Type::STRING,
                ]
            );

            $sequenceName = $this->platform->supportsSequences()
                ? $this->platform->getIdentitySequenceName($this->config->getRevisionTableName(), 'id')
                : null;

            $this->revisionId = $this->conn->lastInsertId($sequenceName);
        }

        return $this->revisionId;
    }
214560
def steam3_to_tuple(value):
    
    match = re.match(r"^\["
                     r"(?P<type>[i%s]):"        # type char
                     r"(?P<universe>[0-4]):"     # universe
                     r"(?P<id>\d{1,10})"            # accountid
                     r"(:(?P<instance>\d+))?"  # instance
                     r"\]$" % ETypeChars,
                     value
                     )
    if not match:
        return None

    steam32 = int(match.group('id'))
    universe = EUniverse(int(match.group('universe')))
    typechar = match.group('type').replace('i', 'I')
    etype = EType(ETypeChar[typechar])
    instance = match.group('instance')

    if typechar in 'gT':
        instance = 0
    elif instance is not None:
        instance = int(instance)
    elif typechar == 'L':
        instance = EInstanceFlag.Lobby
    elif typechar == 'c':
        instance = EInstanceFlag.Clan
    elif etype in (EType.Individual, EType.GameServer):
        instance = 1
    else:
        instance = 0

    instance = int(instance)

    return (steam32, etype, universe, instance)