Jarves\Configuration\Bundle::saveConfig PHP Method

saveConfig() public method

public saveConfig ( string $path, boolean $withDefaults = false ) : boolean
$path string
$withDefaults boolean
return boolean
    public function saveConfig($path, $withDefaults = false)
    {
        $xml = $this->toXml($withDefaults);
        $doc = new \DOMDocument();
        $doc->formatOutput = true;
        $doc->loadXML("<config>{$xml}</config>");
        $xml = trim(substr($doc->saveXML(), strlen('<?xml version="1.0"?>') + 1));
        if (!file_exists($path) && !is_writable(dirname($path)) || file_exists($path) && !is_writable($path)) {
            throw new FileNotWritableException(sprintf('The file `%s` is not writable.', $path));
        }
        return file_put_contents($path, $xml);
    }