From d82f8e8011515a3c46d33290251f8072357be428 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Thu, 21 Apr 2016 09:46:45 +0200 Subject: [PATCH] Config class: write yaml file --- res/php/Config.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/res/php/Config.php b/res/php/Config.php index 32dfda7..7eab4f4 100644 --- a/res/php/Config.php +++ b/res/php/Config.php @@ -54,4 +54,21 @@ class Config $yaml = new \Symfony\Component\Yaml\Parser(); return $yaml->parse(file_get_contents($this->file)); } + + /* + * Write array into confi* + * Write array into config file + * + * @param array config new config + * + * @return FALSE if failed to write + */ + public function writeConfig($config) + { + $dumper = new \Symfony\Component\Yaml\Dumper(); + + $yaml = $dumper->dump($config, 2); + + return file_put_contents($this->file, $yaml); + } }