diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/sharebymail/lib | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) |
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 <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/sharebymail/lib')
-rw-r--r-- | apps/sharebymail/lib/Activity.php | 1 | ||||
-rw-r--r-- | apps/sharebymail/lib/AppInfo/Application.php | 2 | ||||
-rw-r--r-- | apps/sharebymail/lib/Settings/Admin.php | 2 | ||||
-rw-r--r-- | apps/sharebymail/lib/Settings/SettingsManager.php | 1 | ||||
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 27 |
5 files changed, 7 insertions, 26 deletions
diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php index 279055538d9..757b2692e86 100644 --- a/apps/sharebymail/lib/Activity.php +++ b/apps/sharebymail/lib/Activity.php @@ -272,7 +272,6 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else { throw new \InvalidArgumentException(); } diff --git a/apps/sharebymail/lib/AppInfo/Application.php b/apps/sharebymail/lib/AppInfo/Application.php index d294f9716ea..7acb43cfbed 100644 --- a/apps/sharebymail/lib/AppInfo/Application.php +++ b/apps/sharebymail/lib/AppInfo/Application.php @@ -32,7 +32,6 @@ use OCP\AppFramework\App; use OCP\Util; class Application extends App { - public function __construct(array $urlParams = []) { parent::__construct('sharebymail', $urlParams); @@ -47,5 +46,4 @@ class Application extends App { Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareProvider'); Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareByMailSettings'); } - } diff --git a/apps/sharebymail/lib/Settings/Admin.php b/apps/sharebymail/lib/Settings/Admin.php index 251269293ef..23881212692 100644 --- a/apps/sharebymail/lib/Settings/Admin.php +++ b/apps/sharebymail/lib/Settings/Admin.php @@ -39,7 +39,6 @@ class Admin implements ISettings { * @return TemplateResponse */ public function getForm() { - $parameters = [ 'sendPasswordMail' => $this->settingsManager->sendPasswordByMail(), 'enforcePasswordProtection' => $this->settingsManager->enforcePasswordProtection() @@ -65,5 +64,4 @@ class Admin implements ISettings { public function getPriority() { return 40; } - } diff --git a/apps/sharebymail/lib/Settings/SettingsManager.php b/apps/sharebymail/lib/Settings/SettingsManager.php index 8e784e80237..cded3e1713d 100644 --- a/apps/sharebymail/lib/Settings/SettingsManager.php +++ b/apps/sharebymail/lib/Settings/SettingsManager.php @@ -57,5 +57,4 @@ class SettingsManager { $enforcePassword = $this->config->getAppValue('sharebymail', 'enforcePasswordProtection', $this->enforcePasswordProtectionDefault); return $enforcePassword === 'yes'; } - } 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) { |