/** * Unsets a setting value in memory. To persist the change, {@link save()} must be * called afterwards, otherwise the change has no effect. * * @param Setting $setting */ public function deleteValue(Setting $setting) { $this->loadSettingsIfNotDoneYet(); $key = $setting->getKey(); if (array_key_exists($key, $this->settingsValues)) { unset($this->settingsValues[$key]); } }
/** * Returns the current value for a setting. If no value is stored, the default value * is be returned. * * @param Setting $setting * @return mixed * @throws \Exception If the setting does not exist or if the current user is not allowed to change the value * of this setting. */ public function getSettingValue(Setting $setting) { $this->checkIsValidSetting($setting->getName()); if (array_key_exists($setting->getKey(), $this->settingsValues)) { return $this->settingsValues[$setting->getKey()]; } return $setting->defaultValue; }