public function save($path, $withDefaults = false)
{
$string = $this->toXml($withDefaults);
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 false !== file_put_contents($path, $string);
}