%PDF- %PDF-configWriter = $configWriter; $this->reinitableConfig = $reinitableConfig; } /** * @return int */ public function getFrequencyInSec() { return $this->getCurrentFrequencyValue() * self::HOUR_MIN_SEC_VALUE; } /** * @return int */ public function getLastUpdate() { return $this->getValue(self::SYSTEM_VALUE_BLOCK . self::LAST_UPDATE); } /** * @return int */ public function getLastRemovement() { return $this->getValue(self::SYSTEM_VALUE_BLOCK . self::REMOVE_DATE); } /** * Save Last Update */ public function setLastUpdate() { $this->configWriter->save($this->pathPrefix . self::SYSTEM_VALUE_BLOCK . self::LAST_UPDATE, time()); $this->reinitableConfig->reinit(); $this->clean(); } /** * @return int */ public function getFirstModuleRun() { $result = $this->getValue(self::SYSTEM_VALUE_BLOCK . self::FIRST_MODULE_RUN); if (!$result) { $result = time(); $this->configWriter->save($this->pathPrefix . self::SYSTEM_VALUE_BLOCK . self::FIRST_MODULE_RUN, $result); $this->reinitableConfig->reinit(); $this->clean(); } return $result; } /** * Save Last Removement */ public function setLastRemovement() { $this->configWriter->save($this->pathPrefix . self::SYSTEM_VALUE_BLOCK . self::REMOVE_DATE, time()); $this->reinitableConfig->reinit(); $this->clean(); } /** * @return int */ public function getCurrentFrequencyValue() { return $this->getValue(self::NOTIFICATIONS_BLOCK . self::FREQUENCY); } /** * @param int $value */ public function changeFrequency($value) { $this->configWriter->save($this->pathPrefix . self::NOTIFICATIONS_BLOCK . self::FREQUENCY, $value); $this->reinitableConfig->reinit(); $this->clean(); } /** * @return bool */ public function isAdsEnabled() { return (bool)$this->getValue(self::NOTIFICATIONS_BLOCK . self::ADS_ENABLE); } /** * @return array */ public function getEnabledNotificationTypes() { $value = $this->getValue(self::NOTIFICATIONS_BLOCK . self::NOTIFICATIONS_TYPE); return empty($value) ? [] : explode(',', $value); } }