$encodedKey =
$this->
generateRandomKey($prefix,
$length);
if (array_key_exists('show',
$params) ||
(bool) CLI::
getOption('show'
)) { CLI::
write($encodedKey, 'yellow'
);
CLI::
newLine();
return;
} if (!
$this->
setNewEncryptionKey($encodedKey,
$params)) { CLI::
write('Error in setting new encryption key to .env file.', 'light_gray', 'red'
);
CLI::
newLine();
return;
} // force DotEnv to reload the new env vars
putenv('encryption.key'
);
unset($_ENV['encryption.key'
],
$_SERVER['encryption.key'
]);
$dotenv =
new DotEnv(ROOTPATH
);
$dotenv->
load();