This commit is contained in:
Sieciech 2021-08-07 16:59:39 +02:00
parent 996d201575
commit d135a4ec75
1 changed files with 8 additions and 1 deletions

View File

@ -44,7 +44,7 @@ class PutEnv {
foreach ($this->content as $l => $line) { foreach ($this->content as $l => $line) {
if (strlen($line) < 1) { if (strlen($line) < 1) {
if ($lineWasEmpty) { if ($lineWasEmpty) {
unset ($this->content[$l]); $this->content[$l] = null;
} else { } else {
$lineWasEmpty = true; $lineWasEmpty = true;
} }
@ -66,6 +66,13 @@ class PutEnv {
} else if ($changed > 1) { } else if ($changed > 1) {
echo "Key $key changed $changed times\n"; echo "Key $key changed $changed times\n";
} }
$content = $this->content;
$this->content = [];
foreach ($content as $line) {
if ($line !== null) {
$this->content[] = $line;
}
}
$content = implode("\n", $this->content); $content = implode("\n", $this->content);
file_put_contents($this->file, $content); file_put_contents($this->file, $content);
} }