@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function exists(string $key): bool |
44 | 44 | { |
45 | - if (is_null($this->_envVars)) |
|
46 | - $this->_parse(); |
|
45 | + if (is_null($this->_envVars)) { |
|
46 | + $this->_parse(); |
|
47 | + } |
|
47 | 48 | |
48 | 49 | return isset($this->_envVars[strtoupper($key)]); |
49 | 50 | } |
@@ -56,8 +57,9 @@ discard block |
||
56 | 57 | */ |
57 | 58 | public function getValue(string $key): string |
58 | 59 | { |
59 | - if (is_null($this->_envVars)) |
|
60 | - $this->_parse(); |
|
60 | + if (is_null($this->_envVars)) { |
|
61 | + $this->_parse(); |
|
62 | + } |
|
61 | 63 | |
62 | 64 | return $this->_envVars[strtoupper($key)] ?? ''; |
63 | 65 | } |
@@ -71,8 +73,9 @@ discard block |
||
71 | 73 | */ |
72 | 74 | public function getKeyValue(string $key): array |
73 | 75 | { |
74 | - if (is_null($this->_envVars)) |
|
75 | - $this->_parse(); |
|
76 | + if (is_null($this->_envVars)) { |
|
77 | + $this->_parse(); |
|
78 | + } |
|
76 | 79 | |
77 | 80 | return [strtoupper($key) => $this->_envVars[strtoupper($key)]] ?? []; |
78 | 81 | } |
@@ -100,7 +103,9 @@ discard block |
||
100 | 103 | $this->_saved = false; |
101 | 104 | |
102 | 105 | $this->_parse(); |
103 | - if ($write) $this->write(); |
|
106 | + if ($write) { |
|
107 | + $this->write(); |
|
108 | + } |
|
104 | 109 | |
105 | 110 | return $this->getValue($key); |
106 | 111 | |
@@ -123,8 +128,9 @@ discard block |
||
123 | 128 | $this->_changed = true; |
124 | 129 | $this->_saved = false; |
125 | 130 | |
126 | - if ($write) |
|
127 | - $this->write(); |
|
131 | + if ($write) { |
|
132 | + $this->write(); |
|
133 | + } |
|
128 | 134 | |
129 | 135 | } |
130 | 136 |
@@ -46,13 +46,14 @@ |
||
46 | 46 | { |
47 | 47 | $key = $this->argument('key'); |
48 | 48 | |
49 | - if (!is_null($key)) |
|
50 | - $this->isValidKey($key); |
|
49 | + if (!is_null($key)) { |
|
50 | + $this->isValidKey($key); |
|
51 | + } |
|
51 | 52 | |
52 | 53 | $env = new Env(); |
53 | - if (!$env->exists($key)) |
|
54 | - $this->info("There is no variable {$key}"); |
|
55 | - else |
|
54 | + if (!$env->exists($key)) { |
|
55 | + $this->info("There is no variable {$key}"); |
|
56 | + } else |
|
56 | 57 | { |
57 | 58 | $env->deleteVariable($key); |
58 | 59 | $this->info("Variable '{$key}' has been deleted"); |
@@ -45,16 +45,18 @@ |
||
45 | 45 | { |
46 | 46 | $key = $this->argument('key'); |
47 | 47 | |
48 | - if (!is_null($key)) |
|
49 | - $this->isValidKey($key); |
|
48 | + if (!is_null($key)) { |
|
49 | + $this->isValidKey($key); |
|
50 | + } |
|
50 | 51 | |
51 | 52 | $json = $this->option('json'); |
52 | 53 | $keyValFormat = $this->option('key-value'); |
53 | 54 | |
54 | 55 | $env = new Env(); |
55 | 56 | |
56 | - if (is_null($key)) |
|
57 | - $this->line(($json) ? json_encode($env->getVariables()) : $env->getEnvContent()); |
|
57 | + if (is_null($key)) { |
|
58 | + $this->line(($json) ? json_encode($env->getVariables()) : $env->getEnvContent()); |
|
59 | + } |
|
58 | 60 | |
59 | 61 | if (!is_null($key) && $env->exists($key)) { |
60 | 62 | $value = ($json) ? json_encode($env->getKeyValue($key)) : ($keyValFormat ? $env->getKeyValue($key) : $env->getValue($key)); |