@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $key = $this->argument('key'); |
47 | 47 | |
48 | 48 | if (!is_null($key)) |
49 | - $this->isValidKey((string)$key); |
|
49 | + $this->isValidKey((string) $key); |
|
50 | 50 | |
51 | 51 | $json = $this->option('json'); |
52 | 52 | $keyValFormat = $this->option('key-value'); |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | $value = ($json) ? json_encode($env->getKeyValue($key)) : ($keyValFormat ? $env->getKeyValue($key) : $env->getValue($key)); |
61 | 61 | |
62 | 62 | $this->line(($json) |
63 | - ? (string)$value |
|
64 | - : ($keyValFormat ? "{$key}={$value[$key]}" : (string)$value) |
|
63 | + ? (string) $value |
|
64 | + : ($keyValFormat ? "{$key}={$value[$key]}" : (string) $value) |
|
65 | 65 | ); |
66 | 66 | } else { |
67 | 67 | $this->line("There is no variable '{$key}'"); |
@@ -45,16 +45,18 @@ |
||
45 | 45 | { |
46 | 46 | $key = $this->argument('key'); |
47 | 47 | |
48 | - if (!is_null($key)) |
|
49 | - $this->isValidKey((string)$key); |
|
48 | + if (!is_null($key)) { |
|
49 | + $this->isValidKey((string)$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)); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $value = $this->argument('value'); |
70 | 70 | |
71 | 71 | if (is_null($value) || !$value) { |
72 | - $parts = explode('=', (string)$key, 2); |
|
72 | + $parts = explode('=', (string) $key, 2); |
|
73 | 73 | |
74 | 74 | if (count($parts) !== 2) { |
75 | 75 | throw new InvalidArgumentException('No value was set'); |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | [$key, $value] = $parts; |
79 | 79 | } |
80 | 80 | |
81 | - if (Str::contains((string)$key, '=')) { |
|
81 | + if (Str::contains((string) $key, '=')) { |
|
82 | 82 | throw new InvalidArgumentException("Environment key should not contain '='"); |
83 | 83 | } |
84 | 84 | |
85 | - if (!$this->isValidKey((string)$key)) { |
|
85 | + if (!$this->isValidKey((string) $key)) { |
|
86 | 86 | throw new InvalidArgumentException('Invalid argument key'); |
87 | 87 | } |
88 | 88 | |
89 | - return [strtoupper((string)$key), (string)$value]; |
|
89 | + return [strtoupper((string) $key), (string) $value]; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | } |
@@ -47,14 +47,14 @@ |
||
47 | 47 | $key = $this->argument('key'); |
48 | 48 | |
49 | 49 | if (!is_null($key)) |
50 | - $this->isValidKey((string)$key); |
|
50 | + $this->isValidKey((string) $key); |
|
51 | 51 | |
52 | 52 | $env = new Env(); |
53 | - if (!$env->exists((string)$key)) |
|
53 | + if (!$env->exists((string) $key)) |
|
54 | 54 | $this->info("There is no variable {$key}"); |
55 | 55 | else |
56 | 56 | { |
57 | - $env->deleteVariable((string)$key); |
|
57 | + $env->deleteVariable((string) $key); |
|
58 | 58 | $this->info("Variable '{$key}' has been deleted"); |
59 | 59 | } |
60 | 60 | } |
@@ -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"); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | foreach ($env_lines as $line) |
29 | 29 | { |
30 | 30 | if (strlen($line)) { |
31 | - [$key, $val] = explode('=', (string)$line); |
|
31 | + [$key, $val] = explode('=', (string) $line); |
|
32 | 32 | $this->_envVars[$key] = $this->_stripValue($val); |
33 | 33 | } |
34 | 34 | } |