Code Duplication    Length = 12-13 lines in 2 locations

lib/private/User/SyncService.php 2 locations

@@ 278-289 (lines=12) @@
275
	 * @param Account $a
276
	 * @param UserInterface $backend
277
	 */
278
	private function syncDisplayName(Account $a, UserInterface $backend) {
279
		$uid = $a->getUserId();
280
		if ($backend instanceof IProvidesDisplayNameBackend || $backend->implementsActions(\OC_User_Backend::GET_DISPLAYNAME)) {
281
			$displayName = $backend->getDisplayName($uid);
282
			$a->setDisplayName($displayName);
283
			if (\array_key_exists('displayName', $a->getUpdatedFields())) {
284
				$this->logger->debug(
285
					"Setting displayName for <$uid> to <$displayName>", ['app' => self::class]
286
				);
287
			}
288
		}
289
	}
290
291
	/**
292
	 * TODO store username in account table instead of user preferences
@@ 319-331 (lines=13) @@
316
	 * @param Account $a
317
	 * @param UserInterface $backend
318
	 */
319
	private function syncSearchTerms(Account $a, UserInterface $backend) {
320
		$uid = $a->getUserId();
321
		if ($backend instanceof IProvidesExtendedSearchBackend) {
322
			$searchTerms = $backend->getSearchTerms($uid);
323
			$a->setSearchTerms($searchTerms);
324
			if ($a->haveTermsChanged()) {
325
				$logTerms = \implode('|', $searchTerms);
326
				$this->logger->debug(
327
					"Setting searchTerms for <$uid> to <$logTerms>", ['app' => self::class]
328
				);
329
			}
330
		}
331
	}
332
333
	/**
334
	 * @param Account $a