@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * Tries to create a new group. If the group name already exists, false will |
| 71 | 71 | * be returned. |
| 72 | 72 | */ |
| 73 | - public function createGroup( $gid ) { |
|
| 73 | + public function createGroup($gid) { |
|
| 74 | 74 | // Add group |
| 75 | 75 | $result = $this->dbConn->insertIfNotExist('*PREFIX*groups', [ |
| 76 | 76 | 'gid' => $gid, |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * Deletes a group and removes it from the group_user-table |
| 91 | 91 | */ |
| 92 | - public function deleteGroup( $gid ) { |
|
| 92 | + public function deleteGroup($gid) { |
|
| 93 | 93 | // Delete the group |
| 94 | 94 | $qb = $this->dbConn->getQueryBuilder(); |
| 95 | 95 | $qb->delete('groups') |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * |
| 123 | 123 | * Checks whether the user is member of a group or not. |
| 124 | 124 | */ |
| 125 | - public function inGroup( $uid, $gid ) { |
|
| 125 | + public function inGroup($uid, $gid) { |
|
| 126 | 126 | // check |
| 127 | 127 | $qb = $this->dbConn->getQueryBuilder(); |
| 128 | 128 | $cursor = $qb->select('uid') |
@@ -145,16 +145,16 @@ discard block |
||
| 145 | 145 | * |
| 146 | 146 | * Adds a user to a group. |
| 147 | 147 | */ |
| 148 | - public function addToGroup( $uid, $gid ) { |
|
| 148 | + public function addToGroup($uid, $gid) { |
|
| 149 | 149 | // No duplicate entries! |
| 150 | - if( !$this->inGroup( $uid, $gid )) { |
|
| 150 | + if (!$this->inGroup($uid, $gid)) { |
|
| 151 | 151 | $qb = $this->dbConn->getQueryBuilder(); |
| 152 | 152 | $qb->insert('group_user') |
| 153 | 153 | ->setValue('uid', $qb->createNamedParameter($uid)) |
| 154 | 154 | ->setValue('gid', $qb->createNamedParameter($gid)) |
| 155 | 155 | ->execute(); |
| 156 | 156 | return true; |
| 157 | - }else{ |
|
| 157 | + } else { |
|
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * |
| 168 | 168 | * removes the user from a group. |
| 169 | 169 | */ |
| 170 | - public function removeFromGroup( $uid, $gid ) { |
|
| 170 | + public function removeFromGroup($uid, $gid) { |
|
| 171 | 171 | $qb = $this->dbConn->getQueryBuilder(); |
| 172 | 172 | $qb->delete('group_user') |
| 173 | 173 | ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * This function fetches all groups a user belongs to. It does not check |
| 186 | 186 | * if the user exists at all. |
| 187 | 187 | */ |
| 188 | - public function getUserGroups( $uid ) { |
|
| 188 | + public function getUserGroups($uid) { |
|
| 189 | 189 | //guests has empty or null $uid |
| 190 | 190 | if ($uid === null || $uid === '') { |
| 191 | 191 | return []; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | ->execute(); |
| 200 | 200 | |
| 201 | 201 | $groups = []; |
| 202 | - while( $row = $cursor->fetch()) { |
|
| 202 | + while ($row = $cursor->fetch()) { |
|
| 203 | 203 | $groups[] = $row['gid']; |
| 204 | 204 | $this->groupCache[$row['gid']] = $row['gid']; |
| 205 | 205 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | if ($search !== '') { |
| 227 | 227 | $query->where($query->expr()->iLike('gid', $query->createNamedParameter( |
| 228 | - '%' . $this->dbConn->escapeLikeParameter($search) . '%' |
|
| 228 | + '%'.$this->dbConn->escapeLikeParameter($search).'%' |
|
| 229 | 229 | ))); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | if ($search !== '') { |
| 287 | 287 | $query->andWhere($query->expr()->like('uid', $query->createNamedParameter( |
| 288 | - '%' . $this->dbConn->escapeLikeParameter($search) . '%' |
|
| 288 | + '%'.$this->dbConn->escapeLikeParameter($search).'%' |
|
| 289 | 289 | ))); |
| 290 | 290 | } |
| 291 | 291 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | if ($search !== '') { |
| 319 | 319 | $query->andWhere($query->expr()->like('uid', $query->createNamedParameter( |
| 320 | - '%' . $this->dbConn->escapeLikeParameter($search) . '%' |
|
| 320 | + '%'.$this->dbConn->escapeLikeParameter($search).'%' |
|
| 321 | 321 | ))); |
| 322 | 322 | } |
| 323 | 323 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $result->closeCursor(); |
| 327 | 327 | |
| 328 | 328 | if ($count !== false) { |
| 329 | - $count = (int)$count; |
|
| 329 | + $count = (int) $count; |
|
| 330 | 330 | } |
| 331 | 331 | return $count; |
| 332 | 332 | } |