You are here

public function ConfigurationSettingsList::validate in Configuration Management 7.3

Overrides ConfigurationSettings::validate

File

src/Helpers/ConfigurationSettingsList.php, line 37

Class

ConfigurationSettingsList

Namespace

Configuration\Helpers

Code

public function validate() {
  if (!isset($this->settings->configurations)) {
    throw new \Exception("There is no value defined for settings.configurations");
  }
  else {
    foreach ($this->settings->configurations as $identifier => $value) {
      foreach (array(
        'hash',
        'path',
      ) as $key => $value) {
        if (!isset($value[$key])) {
          throw new \Exception("There is no {$key} defined for {$identifier}");
        }
      }
    }
  }
  if (!isset($this->settings->modules)) {
    throw new \Exception("There is no value defined for settings.modules");
  }
  else {
    if (!is_array($this->settings->modules)) {
      throw new \Exception("There settings.modules is not an array");
    }
  }
}