/** * SteamAPIGameSchema constructor. * * @param SteamGame $SteamGame */ public function __construct(SteamGame $SteamGame) { parent::__construct(); if (!$SteamGame->id || in_array($SteamGame->id, SteamGame::getGamesWithNoStats())) { return false; } $this->localfile = 'SteamApi/GetSchemaForGame/' . $SteamGame->id . '.json'; $SteamGameSchemaFromAPI = $this->getSchemaForGameFromApi($SteamGame->id); if (empty($SteamGameSchemaFromAPI)) { return false; } if (!empty($SteamGameSchemaFromAPI->achievements)) { $this->parseAndSaveAchievementSchema($SteamGame->id, $SteamGameSchemaFromAPI->achievements); } if (!empty($SteamGameSchemaFromAPI->stats)) { $this->parseAndSaveStatSchema($SteamGame->id, $SteamGameSchemaFromAPI->stats); } if (!empty($SteamGameSchemaFromAPI->achievements) || !empty($SteamGameSchemaFromAPI->stats)) { $this->success = $this->setGameTimestampForSchema($SteamGame->id); } if ($this->success === true) { Log::info('Schema was updated for ' . $SteamGame->name . ' : ' . $SteamGame->id); } else { Log::error('Schema was NOT updated for ' . $SteamGame->name . ' : ' . $SteamGame->id); } return true; }
/** * SteamAPIGameDescription constructor. * * @param SteamGame $SteamGame */ public function __construct(SteamGame $SteamGame) { parent::__construct(); $this->SteamGame = $SteamGame; $this->localfile = 'SteamApi/SteamApiAppDetails/' . $this->SteamGame->id . '.json'; $this->GameDescriptionJson = $this->getSteamGameDescriptionFromUrl($this->SteamGame->id); $this->success = $this->updateSteamGameWithNewDescription($this->SteamGame, $this->GameDescriptionJson); if ($this->success === true) { Log::info('Description was updated for ' . $this->SteamGame->name . ' : ' . $this->SteamGame->id); } else { Log::error('Description was NOT updated for ' . $this->SteamGame->name . ' : ' . $this->SteamGame->id); } return true; }