You are here

public function ConfigurationSettings::load in Configuration Management 7.3

File

src/Helpers/ConfigurationSettings.php, line 64

Class

ConfigurationSettings

Namespace

Configuration\Helpers

Code

public function load($path = NULL) {
  $directories = array();
  if (!empty($path)) {
    $directories[] = $path;
  }
  $directories[] = $this->base_settings_path;
  $locator = new FileLocator($directories);
  $config_full_path = $locator
    ->locate($this->settings_filename);
  if (!empty($config_full_path)) {
    $file_content = file_get_contents($config_full_path);
    $this->settings = $this
      ->prepareSettings(json_decode($file_content, $this
      ->decodeJsonAsArray()));
    $this
      ->validate();
  }
}