You are here

public function ConfigurationSettings::save in Configuration Management 7.3

File

src/Helpers/ConfigurationSettings.php, line 108

Class

ConfigurationSettings

Namespace

Configuration\Helpers

Code

public function save() {
  $fs = new Filesystem();
  try {
    $fs
      ->mkdir($this->base_settings_path);
    $jsonPretty = new JsonPretty();
    $export = $jsonPretty
      ->prettify($this->settings, NULL, '  ');
    $path = $this->base_settings_path . '/' . $this->settings_filename;
    $fs
      ->dumpFile($path, $export);
  } catch (IOExceptionInterface $e) {
    echo "The directory for configs could not be created: " . $e
      ->getPath();
  }
}