/** * 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; }