summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Service
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/files_external/lib/Service
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-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/files_external/lib/Service')
-rw-r--r--apps/files_external/lib/Service/BackendService.php12
-rw-r--r--apps/files_external/lib/Service/DBConfigService.php8
-rw-r--r--apps/files_external/lib/Service/UserGlobalStoragesService.php1
3 files changed, 10 insertions, 11 deletions
diff --git a/apps/files_external/lib/Service/BackendService.php b/apps/files_external/lib/Service/BackendService.php
index 6c2ea72b840..617b44651ae 100644
--- a/apps/files_external/lib/Service/BackendService.php
+++ b/apps/files_external/lib/Service/BackendService.php
@@ -111,7 +111,7 @@ class BackendService {
private function callForRegistrations() {
static $eventSent = false;
- if(!$eventSent) {
+ if (!$eventSent) {
\OC::$server->getEventDispatcher()->dispatch(
'OCA\\Files_External::loadAdditionalBackends',
new GenericEvent()
@@ -322,15 +322,15 @@ class BackendService {
*/
public function registerConfigHandler(string $placeholder, callable $configHandlerLoader) {
$placeholder = trim(strtolower($placeholder));
- if(!(bool)\preg_match('/^[a-z0-9]*$/', $placeholder)) {
+ if (!(bool)\preg_match('/^[a-z0-9]*$/', $placeholder)) {
throw new \RuntimeException(sprintf(
'Invalid placeholder %s, only [a-z0-9] are allowed', $placeholder
));
}
- if($placeholder === '') {
+ if ($placeholder === '') {
throw new \RuntimeException('Invalid empty placeholder');
}
- if(isset($this->configHandlerLoaders[$placeholder]) || isset($this->configHandlers[$placeholder])) {
+ if (isset($this->configHandlerLoaders[$placeholder]) || isset($this->configHandlers[$placeholder])) {
throw new \RuntimeException(sprintf('A handler is already registered for %s', $placeholder));
}
$this->configHandlerLoaders[$placeholder] = $configHandlerLoader;
@@ -341,7 +341,7 @@ class BackendService {
$newLoaded = false;
foreach ($this->configHandlerLoaders as $placeholder => $loader) {
$handler = $loader();
- if(!$handler instanceof IConfigHandler) {
+ if (!$handler instanceof IConfigHandler) {
throw new \RuntimeException(sprintf(
'Handler for %s is not an instance of IConfigHandler', $placeholder
));
@@ -350,7 +350,7 @@ class BackendService {
$newLoaded = true;
}
$this->configHandlerLoaders = [];
- if($newLoaded) {
+ if ($newLoaded) {
// ensure those with longest placeholders come first,
// to avoid substring matches
uksort($this->configHandlers, function ($phA, $phB) {
diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php
index 265848289f3..51373e8dda6 100644
--- a/apps/files_external/lib/Service/DBConfigService.php
+++ b/apps/files_external/lib/Service/DBConfigService.php
@@ -140,7 +140,7 @@ class DBConfigService {
$stmt->closeCursor();
foreach ($result as $row) {
- if((int)$row['count'] > 1) {
+ if ((int)$row['count'] > 1) {
$this->removeApplicable($row['mount_id'], $applicableType, $applicableId);
} else {
$this->removeMount($row['mount_id']);
@@ -343,7 +343,7 @@ class DBConfigService {
->setValue('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR))
->setValue('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR))
->execute();
- } catch(UniqueConstraintViolationException $e) {
+ } catch (UniqueConstraintViolationException $e) {
$builder = $this->connection->getQueryBuilder();
$query = $builder->update('external_config')
->set('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR))
@@ -366,7 +366,7 @@ class DBConfigService {
->setValue('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR))
->setValue('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR))
->execute();
- } catch(UniqueConstraintViolationException $e) {
+ } catch (UniqueConstraintViolationException $e) {
$builder = $this->connection->getQueryBuilder();
$query = $builder->update('external_options')
->set('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR))
@@ -384,7 +384,7 @@ class DBConfigService {
->setValue('type', $builder->createNamedParameter($type))
->setValue('value', $builder->createNamedParameter($value))
->execute();
- } catch(UniqueConstraintViolationException $e) {
+ } catch (UniqueConstraintViolationException $e) {
// applicable exists already
}
}
diff --git a/apps/files_external/lib/Service/UserGlobalStoragesService.php b/apps/files_external/lib/Service/UserGlobalStoragesService.php
index 0cad7b2535e..7b9af773233 100644
--- a/apps/files_external/lib/Service/UserGlobalStoragesService.php
+++ b/apps/files_external/lib/Service/UserGlobalStoragesService.php
@@ -34,7 +34,6 @@ use OCP\IUserSession;
* Read-only access available, attempting to write will throw DomainException
*/
class UserGlobalStoragesService extends GlobalStoragesService {
-
use UserTrait;
/** @var IGroupManager */