Passed
Push — master ( a30d7c...c7c113 )
by Julius
33:01 queued 16:15
created
lib/private/User/Database.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		if (!$this->userExists($uid)) {
126 126
 			$this->eventDispatcher->dispatchTyped(new ValidatePasswordPolicyEvent($password));
127 127
 
128
-			return $this->atomic(function () use ($uid, $password) {
128
+			return $this->atomic(function() use ($uid, $password) {
129 129
 				$qb = $this->dbConn->getQueryBuilder();
130 130
 				$qb->insert($this->table)
131 131
 					->values([
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return string display name
253 253
 	 */
254 254
 	public function getDisplayName($uid): string {
255
-		$uid = (string)$uid;
255
+		$uid = (string) $uid;
256 256
 		$this->loadUser($uid);
257 257
 		return empty($this->cache[$uid]['displayname']) ? $uid : $this->cache[$uid]['displayname'];
258 258
 	}
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 				$query->expr()->eq('configkey', $query->expr()->literal('email')))
281 281
 			)
282 282
 			// sqlite doesn't like re-using a single named parameter here
283
-			->where($query->expr()->iLike('uid', $query->createPositionalParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')))
284
-			->orWhere($query->expr()->iLike('displayname', $query->createPositionalParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')))
285
-			->orWhere($query->expr()->iLike('configvalue', $query->createPositionalParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')))
283
+			->where($query->expr()->iLike('uid', $query->createPositionalParameter('%'.$this->dbConn->escapeLikeParameter($search).'%')))
284
+			->orWhere($query->expr()->iLike('displayname', $query->createPositionalParameter('%'.$this->dbConn->escapeLikeParameter($search).'%')))
285
+			->orWhere($query->expr()->iLike('configvalue', $query->createPositionalParameter('%'.$this->dbConn->escapeLikeParameter($search).'%')))
286 286
 			->orderBy($query->func()->lower('displayname'), 'ASC')
287 287
 			->addOrderBy('uid_lower', 'ASC')
288 288
 			->setMaxResults($limit)
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 		$result = $query->executeQuery();
292 292
 		$displayNames = [];
293 293
 		while ($row = $result->fetch()) {
294
-			$displayNames[(string)$row['uid']] = (string)$row['displayname'];
294
+			$displayNames[(string) $row['uid']] = (string) $row['displayname'];
295 295
 		}
296 296
 
297 297
 		return $displayNames;
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 			))
321 321
 			->where($query->expr()->eq('k.known_to', $query->createNamedParameter($searcher)))
322 322
 			->andWhere($query->expr()->orX(
323
-				$query->expr()->iLike('u.uid', $query->createNamedParameter('%' . $this->dbConn->escapeLikeParameter($pattern) . '%')),
324
-				$query->expr()->iLike('u.displayname', $query->createNamedParameter('%' . $this->dbConn->escapeLikeParameter($pattern) . '%'))
323
+				$query->expr()->iLike('u.uid', $query->createNamedParameter('%'.$this->dbConn->escapeLikeParameter($pattern).'%')),
324
+				$query->expr()->iLike('u.displayname', $query->createNamedParameter('%'.$this->dbConn->escapeLikeParameter($pattern).'%'))
325 325
 			))
326 326
 			->orderBy('u.displayname', 'ASC')
327 327
 			->addOrderBy('u.uid_lower', 'ASC')
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		$result = $query->execute();
332 332
 		$displayNames = [];
333 333
 		while ($row = $result->fetch()) {
334
-			$displayNames[(string)$row['uid']] = (string)$row['displayname'];
334
+			$displayNames[(string) $row['uid']] = (string) $row['displayname'];
335 335
 		}
336 336
 
337 337
 		return $displayNames;
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 				if (!empty($newHash)) {
358 358
 					$this->updatePassword($loginName, $newHash);
359 359
 				}
360
-				return (string)$this->cache[$loginName]['uid'];
360
+				return (string) $this->cache[$loginName]['uid'];
361 361
 			}
362 362
 		}
363 363
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	private function loadUser($uid) {
374 374
 		$this->fixDI();
375 375
 
376
-		$uid = (string)$uid;
376
+		$uid = (string) $uid;
377 377
 		if (!isset($this->cache[$uid])) {
378 378
 			//guests $uid could be NULL or ''
379 379
 			if ($uid === '') {
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 			// "uid" is primary key, so there can only be a single result
397 397
 			if ($row !== false) {
398 398
 				$this->cache[$uid] = [
399
-					'uid' => (string)$row['uid'],
400
-					'displayname' => (string)$row['displayname'],
401
-					'password' => (string)$row['password'],
399
+					'uid' => (string) $row['uid'],
400
+					'displayname' => (string) $row['displayname'],
401
+					'password' => (string) $row['password'],
402 402
 				];
403 403
 			} else {
404 404
 				$this->cache[$uid] = false;
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 		$limit = $this->fixLimit($limit);
422 422
 
423 423
 		$users = $this->getDisplayNames($search, $limit, $offset);
424
-		$userIds = array_map(function ($uid) {
425
-			return (string)$uid;
424
+		$userIds = array_map(function($uid) {
425
+			return (string) $uid;
426 426
 		}, array_keys($users));
427 427
 		sort($userIds, SORT_STRING | SORT_FLAG_CASE);
428 428
 		return $userIds;
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public function getHome(string $uid) {
449 449
 		if ($this->userExists($uid)) {
450
-			return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid;
450
+			return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/'.$uid;
451 451
 		}
452 452
 
453 453
 		return false;
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 
520 520
 	public function getRealUID(string $uid): string {
521 521
 		if (!$this->userExists($uid)) {
522
-			throw new \RuntimeException($uid . ' does not exist');
522
+			throw new \RuntimeException($uid.' does not exist');
523 523
 		}
524 524
 
525 525
 		return $this->cache[$uid]['uid'];
Please login to merge, or discard this patch.