diff options
author | Faraz Samapoor <f.samapoor@gmail.com> | 2023-04-11 09:29:44 +0330 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-11 09:29:44 +0330 |
commit | 8f4b20aaa172a262482d3884067d0fc8fb116064 (patch) | |
tree | 1041b190db5773a7e96be31f17f522e18eb0dd8d | |
parent | cd44ee2053f105f60c668906ed8460605cb1da81 (diff) | |
download | nextcloud-server-8f4b20aaa172a262482d3884067d0fc8fb116064.tar.gz nextcloud-server-8f4b20aaa172a262482d3884067d0fc8fb116064.zip |
Refactors core/Command/Encryption/Enable.php to improve code readability.
Improves the readability of the "execute" method by using early returns and reducing the code indentation.
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
-rw-r--r-- | core/Command/Encryption/Enable.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/Command/Encryption/Enable.php b/core/Command/Encryption/Enable.php index 9d680144e60..284d96809ae 100644 --- a/core/Command/Encryption/Enable.php +++ b/core/Command/Encryption/Enable.php @@ -59,18 +59,18 @@ class Enable extends Command { if (empty($modules)) { $output->writeln('<error>No encryption module is loaded</error>'); return 1; - } else { - $defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null); - if ($defaultModule === null) { - $output->writeln('<error>No default module is set</error>'); - return 1; - } elseif (!isset($modules[$defaultModule])) { - $output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>'); - return 1; - } else { - $output->writeln('Default module: ' . $defaultModule); - } } + $defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null); + if ($defaultModule === null) { + $output->writeln('<error>No default module is set</error>'); + return 1; + } + if (!isset($modules[$defaultModule])) { + $output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>'); + return 1; + } + $output->writeln('Default module: ' . $defaultModule); + return 0; } } |