Skip to content

Commit 4331b0d

Browse files
AlexJump24jbrooksuk
authored andcommitted
tidy up
1 parent d5c85b4 commit 4331b0d

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/Commands/InstallCommand.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,15 @@ protected function writeEnv(array $values): void
8888

8989
foreach ($values as $key => $value) {
9090
$existingKey = $envFileContents->search(function ($line) use ($key) {
91-
return stripos($line, $key) !== false;
91+
return Str::contains($line, $key, true);
9292
});
9393

94-
if (Str::contains($value, ' ')) {
95-
$value = Str::wrap($value,'"');
96-
}
97-
98-
if ($value === true) {
99-
$value = 'true';
100-
}
101-
102-
if ($value === false) {
103-
$value = 'false';
104-
}
94+
$value = match (true) {
95+
Str::contains($value, ' ') => Str::wrap($value,'"'),
96+
$value === true => 'true',
97+
$value === false => 'false',
98+
default => $value
99+
};
105100

106101
if ($existingKey === false) {
107102
$envFileContents->push($key . '=' . $value);

0 commit comments

Comments
 (0)