<commit_before><?php

/**
 * Community API interface
 * Used to access information unavailable in Steam Web API.
 */
class CommunityAPI
{

    function __construct()
    {
        $this->tools = new LocomotiveTools();
    }

    private function getContent($url)
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        if (curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200) {
            $result = FALSE;
        }
        curl_close($ch);
        return $result;
    }

    public function getOwnedApps($community_id)
    {
        if ($this->tools->users->validateUserId($community_id, USER_ID_TYPE_COMMUNITY) == FALSE)
            throw new WrongIDException();
        $contents = self::getContent('http://steamcommunity.com/profiles/' . $community_id . '/games?tab=all&xml=1');
        if ($contents === FALSE) {
            throw new SteamAPIUnavailableException();
        } else {
            try {
                $xml = new SimpleXMLElement($contents);
                if (isset($xml->error)) {
                    // TODO: Make sure right exception is thrown
                    throw new SteamAPIUnavailableException();
                } else {
                    return $xml->games->game;
                }
            } catch (Exception $e) {
                // Catching XML parsing errors
                // TODO: Handle this properly
                throw new SteamAPIUnavailableException();
            }
        }
    }

    public function getGroupInfoById($group_id)
    {
        $url = 'http://steamcommunity.com/gid/' . $group_id . '/memberslistxml/';
        return self::getGroupInfo($url);
    }

    public function getGroupInfoByName($group_name)
    {
        $url = 'http://steamcommunity.com/groups/' . $group_name . '/memberslistxml/';
        return self::getGroupInfo($url);
    }

    private function getGroupInfo($url)
    {
        $contents = self::getContent($url);
        if ($contents === FALSE) {
            throw new SteamAPIUnavailableException();
        } else {
            // TODO: This is probably not implemented correctly (errors might occur if requested ID was wrong and group doesn't exist)
            $xml = new SimpleXMLElement($contents);
            return $xml;
        }
    }

}<commit_msg>Removed getOwnedApps function form CommunityAPI.<commit_after><?php

/**
 * Community API interface
 * Used to access information unavailable in Steam Web API.
 */
class CommunityAPI
{

    private function getContent($url)
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        if (curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200) {
            $result = FALSE;
        }
        curl_close($ch);
        return $result;
    }

    public function getGroupInfoById($group_id)
    {
        $url = 'http://steamcommunity.com/gid/' . $group_id . '/memberslistxml/';
        return self::getGroupInfo($url);
    }

    public function getGroupInfoByName($group_name)
    {
        $url = 'http://steamcommunity.com/groups/' . $group_name . '/memberslistxml/';
        return self::getGroupInfo($url);
    }

    private function getGroupInfo($url)
    {
        $contents = self::getContent($url);
        if ($contents === FALSE) {
            throw new SteamAPIUnavailableException();
        } else {
            // TODO: This is probably not implemented correctly (errors might occur if requested ID was wrong and group doesn't exist)
            $xml = new SimpleXMLElement($contents);
            return $xml;
        }
    }

}
{'fraction_non_alphanumeric': 0.1174044542205114, 'fraction_numerical': 0.00192466318394281, 'mean_word_length': 2.0830508474576273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4400735', 'n_tokens_mistral': 1033, 'n_tokens_neox': 985, 'n_words': 239}