<commit_before><?php 

class Game extends CI_Model {

    var $errorMessage = '';

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }

    var $resultsPerPage = 10;
   
    // search Giant Bomb API for games  
    function searchForGame($query, $page, $userID) {  
        $url = $this->config->item('gb_api_root') . "/search/?api_key=" . $this->config->item('gb_api_key') . "&format=json&resources=game&limit=" . $this->resultsPerPage . "&page=" . $page . "&query=" . urlencode ($query);
        //echo $url;
        // giant bomb search API is broken. Filter by game resource instead
        //$offset = $this->resultsPerPage * ($page-1);
        //$url = $this->config->item('gb_api_root') . "/games/?api_key=" . $this->config->item('gb_api_key') . "&format=json&limit=" . $this->resultsPerPage . "&offset=" . $offset . "&filter=name:" . urlencode ($query);

        $result = $this->Utility->getData($url);

        if(is_object($result) && $result->error == "OK" && $result->number_of_total_results > 0)
        {                                                                                                    
            foreach($result->results as $game)
            {    
                $game = $this->addCollectionInfo($game, $userID);
            }
            return $result;
        } else {
            return null;
        }
    }

    // get game from Giant Bomb API by ID
    public function getGameByID($gbID, $userID) {   
        $url = $this->config->item('gb_api_root') . "/game/" . $gbID . "?api_key=" . $this->config->item('gb_api_key') . "&format=json";
        //echo $url;
        $result = $this->Utility->getData($url);
        
        if(is_object($result) && $result->error == "OK" && $result->number_of_total_results > 0)
        {
            // add collection info to game object
            return $this->addCollectionInfo($result->results, $userID);
        } else {
            return null;
        }
    }

    // add collection status (ownership and played status) and platforms to game object
    function addCollectionInfo($game, $userID)
    {
        $collection = $this->isGameIsInCollection($game->id, $userID);<commit_msg>Cleanup<commit_after><?php 

class Game extends CI_Model {

    var $errorMessage = '';
    var $resultsPerPage = 10;

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
   
    // search Giant Bomb API for games  
    function searchForGame($query, $page, $userID) {  
        // build API request
        $url = $this->config->item('gb_api_root') . "/search/?api_key=" . $this->config->item('gb_api_key') . "&format=json&resources=game&limit=" . $this->resultsPerPage . "&page=" . $page . "&query=" . urlencode ($query);
      
        // make API request
        $result = $this->Utility->getData($url);

        if(is_object($result) && $result->error == "OK" && $result->number_of_total_results > 0)
        {                                                                                                    
            foreach($result->results as $game)
            {    
                $game = $this->addCollectionInfo($game, $userID);
            }
            return $result;
        } else {
            return null;
        }
    }

    // get game from Giant Bomb API by ID
    public function getGameByID($gbID, $userID) {   
        // build API request
        $url = $this->config->item('gb_api_root') . "/game/" . $gbID . "?api_key=" . $this->config->item('gb_api_key') . "&format=json";

        // make API request
        $result = $this->Utility->getData($url);
        
        if(is_object($result) && $result->error == "OK" && $result->number_of_total_results > 0)
        {
            // add collection info to game object
            return $this->addCollectionInfo($result->results, $userID);
        } else {
            return null;
        }
    }

    // add collection status (ownership and played status) and platforms to game object
    function addCollectionInfo($game, $userID)
    {
        $collection = $this->isGameIsInCollection($game->id, $userID);
{'fraction_non_alphanumeric': 0.15139918679741687, 'fraction_numerical': 0.0021525950729490554, 'mean_word_length': 1.9001386962552012, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6702259', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1188, 'n_words': 264}