@@ -46,13 +46,14 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $key = $this->argument('key'); |
| 48 | 48 | |
| 49 | - if (!is_null($key)) |
|
| 50 | - $this->isValidKey((string)$key); |
|
| 49 | + if (!is_null($key)) { |
|
| 50 | + $this->isValidKey((string)$key); |
|
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | $env = new Env(); |
| 53 | - if (!$env->exists((string)$key)) |
|
| 54 | - $this->info("There is no variable {$key}"); |
|
| 55 | - else |
|
| 54 | + if (!$env->exists((string)$key)) { |
|
| 55 | + $this->info("There is no variable {$key}"); |
|
| 56 | + } else |
|
| 56 | 57 | { |
| 57 | 58 | $env->deleteVariable((string)$key); |
| 58 | 59 | $this->info("Variable '{$key}' has been deleted"); |
@@ -73,8 +73,9 @@ |
||
| 73 | 73 | { |
| 74 | 74 | $this->key = (string)$this->argument('key'); |
| 75 | 75 | |
| 76 | - if (strlen($this->key)) |
|
| 77 | - $this->isValidKey($this->key); |
|
| 76 | + if (strlen($this->key)) { |
|
| 77 | + $this->isValidKey($this->key); |
|
| 78 | + } |
|
| 78 | 79 | |
| 79 | 80 | $this->json = (bool)$this->option('json'); |
| 80 | 81 | $this->keyValFormat = (bool)$this->option('key-value'); |
@@ -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[$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[$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 [$key => $this->_envVars[$key]] ?? []; |
| 78 | 81 | } |
@@ -99,7 +102,9 @@ discard block |
||
| 99 | 102 | $this->_saved = false; |
| 100 | 103 | |
| 101 | 104 | $this->_parse(); |
| 102 | - if ($write) $this->write(); |
|
| 105 | + if ($write) { |
|
| 106 | + $this->write(); |
|
| 107 | + } |
|
| 103 | 108 | |
| 104 | 109 | return $this->getValue($key); |
| 105 | 110 | |
@@ -120,8 +125,9 @@ discard block |
||
| 120 | 125 | $this->_changed = true; |
| 121 | 126 | $this->_saved = false; |
| 122 | 127 | |
| 123 | - if ($write) |
|
| 124 | - $this->write(); |
|
| 128 | + if ($write) { |
|
| 129 | + $this->write(); |
|
| 130 | + } |
|
| 125 | 131 | |
| 126 | 132 | } |
| 127 | 133 | |