Config class: write yaml file

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-04-21 09:46:45 +02:00
parent 4e91eeb3ab
commit d82f8e8011

View file

@ -54,4 +54,21 @@ class Config
$yaml = new \Symfony\Component\Yaml\Parser(); $yaml = new \Symfony\Component\Yaml\Parser();
return $yaml->parse(file_get_contents($this->file)); 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);
}
} }