diff --git a/Dotenv.php b/Dotenv.php index 9ba622c40ac8860ab3b8d91f872e0ab3ce79f2a0..21a70c734bc9a035a4d01b7bc261693382e8caa3 100644 --- a/Dotenv.php +++ b/Dotenv.php @@ -48,7 +48,7 @@ final class Dotenv { } /** - * Receive a value from the environment. + * Receive a value from the environment with the project name as prefix. * * First of all, it prefixes the key with the plugin name and converts the * result into upper case. Then looking for the value with PHP's getenv and if @@ -67,7 +67,24 @@ final class Dotenv { * The value. */ public function receive($key, $prompt, $default = '') { - $key = $this->name . '_' . strtoupper($key); + return $this->receiveGlobal($this->name . '_' . $key, $prompt, $default); + } + + /** + * Receive a value from the environment. + * + * @param string $key + * The key of the environment variable. + * @param string $prompt + * The text being displayed when prompting the user. + * @param string $default + * The default value. + * + * @return string + * The value. + */ + public function receiveGlobal($key, $prompt, $default = '') { + $key = strtoupper($key); $value = getenv($key); if (empty($value)) { if ($this->io->isInteractive()) {