Code Duplication    Length = 8-11 lines in 2 locations

lib/private/legacy/user.php 2 locations

@@ 266-276 (lines=11) @@
263
	 * @param string $displayName
264
	 * @return bool Whether the display name could get set
265
	 */
266
	public static function setDisplayName($uid, $displayName = null) {
267
		if (is_null($displayName)) {
268
			$displayName = $uid;
269
		}
270
		$user = \OC::$server->getUserManager()->get($uid);
271
		if ($user) {
272
			return $user->setDisplayName($displayName);
273
		} else {
274
			return false;
275
		}
276
	}
277
278
	/**
279
	 * Check if the user is logged in, considers also the HTTP basic credentials
@@ 474-481 (lines=8) @@
471
	 * Check if the password is correct without logging in the user
472
	 * returns the user id or false
473
	 */
474
	public static function checkPassword($uid, $password) {
475
		$manager = \OC::$server->getUserManager();
476
		$username = $manager->checkPassword($uid, $password);
477
		if ($username !== false) {
478
			return $username->getUID();
479
		}
480
		return false;
481
	}
482
483
	/**
484
	 * @param string $uid The username