diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/federation/lib | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
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/federation/lib')
-rw-r--r-- | apps/federation/lib/AppInfo/Application.php | 2 | ||||
-rw-r--r-- | apps/federation/lib/BackgroundJob/GetSharedSecret.php | 2 | ||||
-rw-r--r-- | apps/federation/lib/BackgroundJob/RequestSharedSecret.php | 3 | ||||
-rw-r--r-- | apps/federation/lib/Command/SyncFederationAddressBooks.php | 2 | ||||
-rw-r--r-- | apps/federation/lib/Controller/OCSAuthAPIController.php | 3 | ||||
-rw-r--r-- | apps/federation/lib/Controller/SettingsController.php | 1 | ||||
-rw-r--r-- | apps/federation/lib/DbHandler.php | 1 | ||||
-rw-r--r-- | apps/federation/lib/Hooks.php | 1 | ||||
-rw-r--r-- | apps/federation/lib/Middleware/AddServerMiddleware.php | 2 | ||||
-rw-r--r-- | apps/federation/lib/Settings/Admin.php | 1 | ||||
-rw-r--r-- | apps/federation/lib/SyncFederationAddressBooks.php | 1 | ||||
-rw-r--r-- | apps/federation/lib/TrustedServers.php | 3 |
12 files changed, 1 insertions, 21 deletions
diff --git a/apps/federation/lib/AppInfo/Application.php b/apps/federation/lib/AppInfo/Application.php index 119756b16e4..cc5f63309af 100644 --- a/apps/federation/lib/AppInfo/Application.php +++ b/apps/federation/lib/AppInfo/Application.php @@ -57,7 +57,6 @@ class Application extends App { * list of trusted servers. */ public function registerHooks() { - $container = $this->getContainer(); $hooksManager = $container->query(Hooks::class); @@ -81,5 +80,4 @@ class Application extends App { } }); } - } diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php index ad526885d0f..c86c7f1d75a 100644 --- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php @@ -181,7 +181,6 @@ class GetSharedSecret extends Job { ); $status = $result->getStatusCode(); - } catch (ClientException $e) { $status = $e->getCode(); if ($status === Http::STATUS_FORBIDDEN) { @@ -232,7 +231,6 @@ class GetSharedSecret extends Job { $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); } } - } /** diff --git a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php index 4eaa94a53d5..990f5025bf5 100644 --- a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php @@ -142,7 +142,6 @@ class RequestSharedSecret extends Job { } protected function run($argument) { - $target = $argument['url']; $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime(); $currentTime = $this->timeFactory->getTime(); @@ -179,7 +178,6 @@ class RequestSharedSecret extends Job { ); $status = $result->getStatusCode(); - } catch (ClientException $e) { $status = $e->getCode(); if ($status === Http::STATUS_FORBIDDEN) { @@ -205,7 +203,6 @@ class RequestSharedSecret extends Job { ) { $this->retainJob = true; } - } /** diff --git a/apps/federation/lib/Command/SyncFederationAddressBooks.php b/apps/federation/lib/Command/SyncFederationAddressBooks.php index cad000cf71f..709cd60b3ba 100644 --- a/apps/federation/lib/Command/SyncFederationAddressBooks.php +++ b/apps/federation/lib/Command/SyncFederationAddressBooks.php @@ -57,13 +57,11 @@ class SyncFederationAddressBooks extends Command { * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { - $progress = new ProgressBar($output); $progress->start(); $this->syncService->syncThemAll(function ($url, $ex) use ($progress, $output) { if ($ex instanceof \Exception) { $output->writeln("Error while syncing $url : " . $ex->getMessage()); - } else { $progress->advance(); } diff --git a/apps/federation/lib/Controller/OCSAuthAPIController.php b/apps/federation/lib/Controller/OCSAuthAPIController.php index 38293dca736..ecd0757f6fb 100644 --- a/apps/federation/lib/Controller/OCSAuthAPIController.php +++ b/apps/federation/lib/Controller/OCSAuthAPIController.php @@ -46,7 +46,7 @@ use OCP\Security\ISecureRandom; * * @package OCA\Federation\Controller */ -class OCSAuthAPIController extends OCSController{ +class OCSAuthAPIController extends OCSController { /** @var ISecureRandom */ private $secureRandom; @@ -181,7 +181,6 @@ class OCSAuthAPIController extends OCSController{ * @throws OCSForbiddenException */ public function getSharedSecret($url, $token) { - if ($this->trustedServers->isTrustedServer($url) === false) { $this->logger->error('remote server not trusted (' . $url . ') while getting shared secret', ['app' => 'federation']); throw new OCSForbiddenException(); diff --git a/apps/federation/lib/Controller/SettingsController.php b/apps/federation/lib/Controller/SettingsController.php index 00b2885f66d..7f68f238366 100644 --- a/apps/federation/lib/Controller/SettingsController.php +++ b/apps/federation/lib/Controller/SettingsController.php @@ -119,5 +119,4 @@ class SettingsController extends Controller { return true; } - } diff --git a/apps/federation/lib/DbHandler.php b/apps/federation/lib/DbHandler.php index 6adad5b69d1..dddb7e13297 100644 --- a/apps/federation/lib/DbHandler.php +++ b/apps/federation/lib/DbHandler.php @@ -330,5 +330,4 @@ class DbHandler { $statement->closeCursor(); return !empty($result); } - } diff --git a/apps/federation/lib/Hooks.php b/apps/federation/lib/Hooks.php index 3f6a45422a7..f02409ef242 100644 --- a/apps/federation/lib/Hooks.php +++ b/apps/federation/lib/Hooks.php @@ -44,5 +44,4 @@ class Hooks { $this->trustedServers->addServer($params['server']); } } - } diff --git a/apps/federation/lib/Middleware/AddServerMiddleware.php b/apps/federation/lib/Middleware/AddServerMiddleware.php index 043d10d0455..ffce7710223 100644 --- a/apps/federation/lib/Middleware/AddServerMiddleware.php +++ b/apps/federation/lib/Middleware/AddServerMiddleware.php @@ -87,7 +87,5 @@ class AddServerMiddleware extends Middleware { ['message' => $message], Http::STATUS_BAD_REQUEST ); - } - } diff --git a/apps/federation/lib/Settings/Admin.php b/apps/federation/lib/Settings/Admin.php index d363397e9e7..9dd06dc8f53 100644 --- a/apps/federation/lib/Settings/Admin.php +++ b/apps/federation/lib/Settings/Admin.php @@ -65,5 +65,4 @@ class Admin implements ISettings { public function getPriority() { return 30; } - } diff --git a/apps/federation/lib/SyncFederationAddressBooks.php b/apps/federation/lib/SyncFederationAddressBooks.php index f0e3d2ba38b..3ec233df037 100644 --- a/apps/federation/lib/SyncFederationAddressBooks.php +++ b/apps/federation/lib/SyncFederationAddressBooks.php @@ -60,7 +60,6 @@ class SyncFederationAddressBooks { * @param \Closure $callback */ public function syncThemAll(\Closure $callback) { - $trustedServers = $this->dbHandler->getAllServer(); foreach ($trustedServers as $trustedServer) { $url = $trustedServer['url']; diff --git a/apps/federation/lib/TrustedServers.php b/apps/federation/lib/TrustedServers.php index 2a3a2d809b9..3d659e7eb95 100644 --- a/apps/federation/lib/TrustedServers.php +++ b/apps/federation/lib/TrustedServers.php @@ -239,7 +239,6 @@ class TrustedServers { ); if ($result->getStatusCode() === Http::STATUS_OK) { $isValidOwnCloud = $this->checkOwnCloudVersion($result->getBody()); - } } catch (\Exception $e) { \OC::$server->getLogger()->logException($e, [ @@ -282,9 +281,7 @@ class TrustedServers { strpos($url, 'https://') === 0 || strpos($url, 'http://') === 0 ) { - return $url; - } return 'https://' . $url; |