From caff1023ea72bb2ea94130e18a2a6e2ccf819e5f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Apr 2020 14:19:56 +0200 Subject: Format control structures, classes, methods and function To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst --- apps/encryption/lib/Command/DisableMasterKey.php | 6 +----- apps/encryption/lib/Command/EnableMasterKey.php | 6 +----- apps/encryption/lib/Command/RecoverUser.php | 8 ++------ 3 files changed, 4 insertions(+), 16 deletions(-) (limited to 'apps/encryption/lib/Command') diff --git a/apps/encryption/lib/Command/DisableMasterKey.php b/apps/encryption/lib/Command/DisableMasterKey.php index 18bf0b3903d..d59e3b586c8 100644 --- a/apps/encryption/lib/Command/DisableMasterKey.php +++ b/apps/encryption/lib/Command/DisableMasterKey.php @@ -50,7 +50,6 @@ class DisableMasterKey extends Command { public function __construct(Util $util, IConfig $config, QuestionHelper $questionHelper) { - $this->util = $util; $this->config = $config; $this->questionHelper = $questionHelper; @@ -64,10 +63,9 @@ class DisableMasterKey extends Command { } protected function execute(InputInterface $input, OutputInterface $output) { - $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); - if(!$isMasterKeyEnabled) { + if (!$isMasterKeyEnabled) { $output->writeln('Master key already disabled'); } else { $question = new ConfirmationQuestion( @@ -83,7 +81,5 @@ class DisableMasterKey extends Command { $output->writeln('aborted.'); } } - } - } diff --git a/apps/encryption/lib/Command/EnableMasterKey.php b/apps/encryption/lib/Command/EnableMasterKey.php index d1148c88ccd..6c4645e7212 100644 --- a/apps/encryption/lib/Command/EnableMasterKey.php +++ b/apps/encryption/lib/Command/EnableMasterKey.php @@ -49,7 +49,6 @@ class EnableMasterKey extends Command { public function __construct(Util $util, IConfig $config, QuestionHelper $questionHelper) { - $this->util = $util; $this->config = $config; $this->questionHelper = $questionHelper; @@ -63,10 +62,9 @@ class EnableMasterKey extends Command { } protected function execute(InputInterface $input, OutputInterface $output) { - $isAlreadyEnabled = $this->util->isMasterKeyEnabled(); - if($isAlreadyEnabled) { + if ($isAlreadyEnabled) { $output->writeln('Master key already enabled'); } else { $question = new ConfirmationQuestion( @@ -79,7 +77,5 @@ class EnableMasterKey extends Command { $output->writeln('aborted.'); } } - } - } diff --git a/apps/encryption/lib/Command/RecoverUser.php b/apps/encryption/lib/Command/RecoverUser.php index 9d98b38de47..a4d7b2407d6 100644 --- a/apps/encryption/lib/Command/RecoverUser.php +++ b/apps/encryption/lib/Command/RecoverUser.php @@ -54,7 +54,6 @@ class RecoverUser extends Command { IConfig $config, IUserManager $userManager, QuestionHelper $questionHelper) { - $this->util = $util; $this->questionHelper = $questionHelper; $this->userManager = $userManager; @@ -74,10 +73,9 @@ class RecoverUser extends Command { } protected function execute(InputInterface $input, OutputInterface $output) { - $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); - if($isMasterKeyEnabled) { + if ($isMasterKeyEnabled) { $output->writeln('You use the master key, no individual user recovery needed.'); return; } @@ -90,7 +88,7 @@ class RecoverUser extends Command { } $recoveryKeyEnabled = $this->util->isRecoveryEnabledForUser($uid); - if($recoveryKeyEnabled === false) { + if ($recoveryKeyEnabled === false) { $output->writeln('Recovery key is not enabled for: ' . $uid); return; } @@ -108,7 +106,5 @@ class RecoverUser extends Command { $output->write('Start to recover users files... This can take some time...'); $this->userManager->get($uid)->setPassword($newLoginPassword, $recoveryPassword); $output->writeln('Done.'); - } - } -- cgit v1.2.3