summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/Mapping
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/user_ldap/lib/Mapping
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/user_ldap/lib/Mapping')
-rw-r--r--apps/user_ldap/lib/Mapping/AbstractMapping.php16
-rw-r--r--apps/user_ldap/lib/Mapping/GroupMapping.php1
-rw-r--r--apps/user_ldap/lib/Mapping/UserMapping.php1
3 files changed, 8 insertions, 10 deletions
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php
index 5d445af6b7e..e14c9a572de 100644
--- a/apps/user_ldap/lib/Mapping/AbstractMapping.php
+++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php
@@ -55,7 +55,7 @@ abstract class AbstractMapping {
* @return bool
*/
public function isColNameValid($col) {
- switch($col) {
+ switch ($col) {
case 'ldap_dn':
case 'owncloud_name':
case 'directory_uuid':
@@ -74,7 +74,7 @@ abstract class AbstractMapping {
* @return string|false
*/
protected function getXbyY($fetchCol, $compareCol, $search) {
- if(!$this->isColNameValid($fetchCol)) {
+ if (!$this->isColNameValid($fetchCol)) {
//this is used internally only, but we don't want to risk
//having SQL injection at all.
throw new \Exception('Invalid Column Name');
@@ -86,7 +86,7 @@ abstract class AbstractMapping {
');
$res = $query->execute([$search]);
- if($res !== false) {
+ if ($res !== false) {
return $query->fetchColumn();
}
@@ -174,8 +174,8 @@ abstract class AbstractMapping {
$res = $query->execute([$prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch]);
$names = [];
- if($res !== false) {
- while($row = $query->fetch()) {
+ if ($res !== false) {
+ while ($row = $query->fetch()) {
$names[] = $row['owncloud_name'];
}
}
@@ -230,7 +230,7 @@ abstract class AbstractMapping {
* @return bool
*/
public function map($fdn, $name, $uuid) {
- if(mb_strlen($fdn) > 255) {
+ if (mb_strlen($fdn) > 255) {
\OC::$server->getLogger()->error(
'Cannot map, because the DN exceeds 255 characters: {dn}',
[
@@ -295,9 +295,9 @@ abstract class AbstractMapping {
->from($this->getTableName());
$cursor = $picker->execute();
$result = true;
- while($id = $cursor->fetchColumn(0)) {
+ while ($id = $cursor->fetchColumn(0)) {
$preCallback($id);
- if($isUnmapped = $this->unmap($id)) {
+ if ($isUnmapped = $this->unmap($id)) {
$postCallback($id);
}
$result &= $isUnmapped;
diff --git a/apps/user_ldap/lib/Mapping/GroupMapping.php b/apps/user_ldap/lib/Mapping/GroupMapping.php
index cc779817f1a..b2c1b9c99af 100644
--- a/apps/user_ldap/lib/Mapping/GroupMapping.php
+++ b/apps/user_ldap/lib/Mapping/GroupMapping.php
@@ -36,5 +36,4 @@ class GroupMapping extends AbstractMapping {
protected function getTableName() {
return '*PREFIX*ldap_group_mapping';
}
-
}
diff --git a/apps/user_ldap/lib/Mapping/UserMapping.php b/apps/user_ldap/lib/Mapping/UserMapping.php
index 31ac8a05326..556f7ecf1a4 100644
--- a/apps/user_ldap/lib/Mapping/UserMapping.php
+++ b/apps/user_ldap/lib/Mapping/UserMapping.php
@@ -36,5 +36,4 @@ class UserMapping extends AbstractMapping {
protected function getTableName() {
return '*PREFIX*ldap_user_mapping';
}
-
}