You are here

public function ConfigurationSettings::get in Configuration Management 7.3

File

src/Helpers/ConfigurationSettings.php, line 122

Class

ConfigurationSettings

Namespace

Configuration\Helpers

Code

public function get($key) {
  if (isset($this->cache[$key])) {
    return $this->cache[$key];
  }
  $accessor = PropertyAccess::createPropertyAccessor();
  if ($accessor
    ->isReadable($this->settings, $key)) {
    $this->cache[$key] = $accessor
      ->getValue($this->settings, $key);
    return $this->cache[$key];
  }
  else {
    throw new \Exception("Error trying to read the property " . $key);
  }
}