Remove a metadata file if empty when saving
This commit is contained in:
parent
7d2ada5e86
commit
c82ed9dbf3
|
@ -65,11 +65,15 @@ public function isDirty(): bool
|
|||
*/
|
||||
public function save(): bool
|
||||
{
|
||||
if (!$this->isDirty() || empty($this->content)) {
|
||||
if (!$this->isDirty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($this->content)) {
|
||||
$this->disk->delete($this->filename);
|
||||
} else {
|
||||
$this->writeToDisk($this->content);
|
||||
}
|
||||
|
||||
$this->originalContent = $this->content;
|
||||
|
||||
|
@ -94,11 +98,15 @@ public function set($key, $value, bool $respectDots = true)
|
|||
/**
|
||||
* Set many values at once
|
||||
*/
|
||||
public function setMany(array $array)
|
||||
public function setMany(array $array, bool $replace = false)
|
||||
{
|
||||
if (!$replace) {
|
||||
foreach ($array as $key => $value) {
|
||||
$this->set($key, $value);
|
||||
}
|
||||
} else {
|
||||
$this->content = $array;
|
||||
}
|
||||
}
|
||||
|
||||
public function merge(array $array)
|
||||
|
|
Loading…
Reference in New Issue
Block a user