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/sharebymail/lib/ShareByMailProvider.php | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'apps/sharebymail/lib/ShareByMailProvider.php') diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 220f3e6454b..4292ac9bf18 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -173,7 +173,6 @@ class ShareByMailProvider implements IShareProvider { * @throws \Exception */ public function create(IShare $share) { - $shareWith = $share->getSharedWith(); /* * Check if file is not already shared with the remote user @@ -204,7 +203,6 @@ class ShareByMailProvider implements IShareProvider { $data = $this->getRawShare($shareId); return $this->createShareObject($data); - } /** @@ -261,7 +259,6 @@ class ShareByMailProvider implements IShareProvider { * @param string $type */ protected function createShareActivity(IShare $share, string $type = 'share') { - $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); $this->publishActivity( @@ -285,7 +282,6 @@ class ShareByMailProvider implements IShareProvider { (string) $ownerFolder->getRelativePath($ownerPath) ); } - } /** @@ -296,7 +292,6 @@ class ShareByMailProvider implements IShareProvider { * @param bool $sendToSelf */ protected function createPasswordSendActivity(IShare $share, $sharedWith, $sendToSelf) { - $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); if ($sendToSelf) { @@ -336,7 +331,6 @@ class ShareByMailProvider implements IShareProvider { ->setAffectedUser($affectedUser) ->setObject('files', $fileId, $filePath); $this->activityManager->publish($event); - } /** @@ -389,7 +383,6 @@ class ShareByMailProvider implements IShareProvider { } return $shareId; - } /** @@ -447,7 +440,7 @@ class ShareByMailProvider implements IShareProvider { // The "Reply-To" is set to the sharer if an mail address is configured // also the default footer contains a "Do not reply" which needs to be adjusted. $initiatorEmail = $initiatorUser->getEMailAddress(); - if($initiatorEmail !== null) { + if ($initiatorEmail !== null) { $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')); } else { @@ -466,7 +459,6 @@ class ShareByMailProvider implements IShareProvider { * @return bool */ protected function sendPassword(IShare $share, $password) { - $filename = $share->getNode()->getName(); $initiator = $share->getSharedBy(); $shareWith = $share->getSharedWith(); @@ -526,7 +518,6 @@ class ShareByMailProvider implements IShareProvider { } protected function sendNote(IShare $share) { - $recipient = $share->getSharedWith(); @@ -577,7 +568,6 @@ class ShareByMailProvider implements IShareProvider { $message->setTo([$recipient]); $message->useTemplate($emailTemplate); $this->mailer->send($message); - } /** @@ -590,7 +580,6 @@ class ShareByMailProvider implements IShareProvider { * @throws \Exception */ protected function sendPasswordToOwner(IShare $share, $password) { - $filename = $share->getNode()->getName(); $initiator = $this->userManager->get($share->getSharedBy()); $initiatorEMailAddress = ($initiator instanceof IUser) ? $initiator->getEMailAddress() : null; @@ -668,7 +657,7 @@ class ShareByMailProvider implements IShareProvider { ->orderBy('id'); $cursor = $qb->execute(); - while($data = $cursor->fetch()) { + while ($data = $cursor->fetch()) { $children[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -728,13 +717,12 @@ class ShareByMailProvider implements IShareProvider { * @return IShare The share object */ public function update(IShare $share, $plainTextPassword = null) { - $originalShare = $this->getShareById($share->getId()); // a real password was given $validPassword = $plainTextPassword !== null && $plainTextPassword !== ''; - if($validPassword && ($originalShare->getPassword() !== $share->getPassword() || + if ($validPassword && ($originalShare->getPassword() !== $share->getPassword() || ($originalShare->getSendPasswordByTalk() && !$share->getSendPasswordByTalk()))) { $this->sendPassword($share, $plainTextPassword); } @@ -844,7 +832,7 @@ class ShareByMailProvider implements IShareProvider { $cursor = $qb->execute(); $shares = []; - while($data = $cursor->fetch()) { + while ($data = $cursor->fetch()) { $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -896,7 +884,7 @@ class ShareByMailProvider implements IShareProvider { ->execute(); $shares = []; - while($data = $cursor->fetch()) { + while ($data = $cursor->fetch()) { $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -935,7 +923,7 @@ class ShareByMailProvider implements IShareProvider { $cursor = $qb->execute(); - while($data = $cursor->fetch()) { + while ($data = $cursor->fetch()) { $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -996,7 +984,6 @@ class ShareByMailProvider implements IShareProvider { * @throws ShareNotFound */ protected function createShareObject($data) { - $share = new Share($this->rootFolder, $this->userManager); $share->setId((int)$data['id']) ->setShareType((int)$data['share_type']) @@ -1204,7 +1191,7 @@ class ShareByMailProvider implements IShareProvider { ); $cursor = $qb->execute(); - while($data = $cursor->fetch()) { + while ($data = $cursor->fetch()) { try { $share = $this->createShareObject($data); } catch (InvalidShare $e) { -- cgit v1.2.3