summaryrefslogtreecommitdiffstats
path: root/lib/private/Group
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 /lib/private/Group
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 'lib/private/Group')
-rw-r--r--lib/private/Group/Backend.php4
-rw-r--r--lib/private/Group/Database.php9
-rw-r--r--lib/private/Group/Group.php8
-rw-r--r--lib/private/Group/MetaData.php8
4 files changed, 14 insertions, 15 deletions
diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php
index 4e2f912e7fc..0f0e2c743e8 100644
--- a/lib/private/Group/Backend.php
+++ b/lib/private/Group/Backend.php
@@ -53,8 +53,8 @@ abstract class Backend implements \OCP\GroupInterface {
*/
public function getSupportedActions() {
$actions = 0;
- foreach($this->possibleActions as $action => $methodName) {
- if(method_exists($this, $methodName)) {
+ foreach ($this->possibleActions as $action => $methodName) {
+ if (method_exists($this, $methodName)) {
$actions |= $action;
}
}
diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php
index 99654b5d1f2..b75dc097c97 100644
--- a/lib/private/Group/Database.php
+++ b/lib/private/Group/Database.php
@@ -113,7 +113,7 @@ class Database extends ABackend
->setValue('gid', $builder->createNamedParameter($gid))
->setValue('displayname', $builder->createNamedParameter($gid))
->execute();
- } catch(UniqueConstraintViolationException $e) {
+ } catch (UniqueConstraintViolationException $e) {
$result = 0;
}
@@ -194,14 +194,14 @@ class Database extends ABackend
$this->fixDI();
// No duplicate entries!
- if(!$this->inGroup($uid, $gid)) {
+ if (!$this->inGroup($uid, $gid)) {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('group_user')
->setValue('uid', $qb->createNamedParameter($uid))
->setValue('gid', $qb->createNamedParameter($gid))
->execute();
return true;
- }else{
+ } else {
return false;
}
}
@@ -250,7 +250,7 @@ class Database extends ABackend
->execute();
$groups = [];
- while($row = $cursor->fetch()) {
+ while ($row = $cursor->fetch()) {
$groups[] = $row['gid'];
$this->groupCache[$row['gid']] = $row['gid'];
}
@@ -473,5 +473,4 @@ class Database extends ABackend
return true;
}
-
}
diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php
index 9eb1b616609..2e16d5f1242 100644
--- a/lib/private/Group/Group.php
+++ b/lib/private/Group/Group.php
@@ -265,8 +265,8 @@ class Group implements IGroup {
public function count($search = '') {
$users = false;
foreach ($this->backends as $backend) {
- if($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) {
- if($users === false) {
+ if ($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) {
+ if ($users === false) {
//we could directly add to a bool variable, but this would
//be ugly
$users = 0;
@@ -285,8 +285,8 @@ class Group implements IGroup {
public function countDisabled() {
$users = false;
foreach ($this->backends as $backend) {
- if($backend instanceof ICountDisabledInGroup) {
- if($users === false) {
+ if ($backend instanceof ICountDisabledInGroup) {
+ if ($users === false) {
//we could directly add to a bool variable, but this would
//be ugly
$users = 0;
diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php
index 335bf43c16b..880dbf6437c 100644
--- a/lib/private/Group/MetaData.php
+++ b/lib/private/Group/MetaData.php
@@ -83,7 +83,7 @@ class MetaData {
*/
public function get($groupSearch = '', $userSearch = '') {
$key = $groupSearch . '::' . $userSearch;
- if(isset($this->metaData[$key])) {
+ if (isset($this->metaData[$key])) {
return $this->metaData[$key];
}
@@ -94,7 +94,7 @@ class MetaData {
$sortAdminGroupsIndex = 0;
$sortAdminGroupsKeys = [];
- foreach($this->getGroups($groupSearch) as $group) {
+ foreach ($this->getGroups($groupSearch) as $group) {
$groupMetaData = $this->generateGroupMetaData($group, $userSearch);
if (strtolower($group->getGID()) !== 'admin') {
$this->addEntry(
@@ -194,11 +194,11 @@ class MetaData {
* @return \OCP\IGroup[]
*/
public function getGroups($search = '') {
- if($this->isAdmin) {
+ if ($this->isAdmin) {
return $this->groupManager->search($search);
} else {
$userObject = $this->userSession->getUser();
- if($userObject !== null) {
+ if ($userObject !== null) {
$groups = $this->groupManager->getSubAdmin()->getSubAdminsGroups($userObject);
} else {
$groups = [];