You are here

public function ConfigurationSettings::set in Configuration Management 7.3

File

src/Helpers/ConfigurationSettings.php, line 137

Class

ConfigurationSettings

Namespace

Configuration\Helpers

Code

public function set($key, $value) {
  $accessor = PropertyAccess::createPropertyAccessor();
  if ($accessor
    ->isWritable($this->settings, $key)) {
    $accessor
      ->setValue($this->settings, $key, $value);
    $this->cache[$key] = $value;
    return $this;
  }
  else {
    throw new \Exception("Error trying to write a value for the property " . $key);
  }
}