. */ namespace SP\Services\Config; use SP\Services\Service; use SP\Services\ServiceException; /** * Class ConfigBackupService * * @package SP\Services\Config */ class ConfigBackupService extends Service { /** * @var ConfigService */ protected $configService; /** * Backups the config data into the database */ public function backup() { try { $this->configService->save('config_backup', bin2hex(gzcompress(serialize($this->config->getConfigData())))); $this->configService->save('config_backup_date', time()); } catch (\Exception $e) { processException($e); } } /** * @throws ServiceException */ public function restore() { throw new ServiceException('Not implemented'); } protected function initialize() { $this->configService = $this->dic->get(ConfigService::class); } }