Code Duplication    Length = 12-13 lines in 2 locations

lib/private/User/SyncService.php 2 locations

@@ 258-269 (lines=12) @@
255
	 * @param Account $a
256
	 * @param UserInterface $backend
257
	 */
258
	private function syncDisplayName(Account $a, UserInterface $backend) {
259
		$uid = $a->getUserId();
260
		if ($backend instanceof IProvidesDisplayNameBackend || $backend->implementsActions(\OC_User_Backend::GET_DISPLAYNAME)) {
261
			$displayName = $backend->getDisplayName($uid);
262
			$a->setDisplayName($displayName);
263
			if (array_key_exists('displayName', $a->getUpdatedFields())) {
264
				$this->logger->debug(
265
					"Setting displayName for <$uid> to <$displayName>", ['app' => self::class]
266
				);
267
			}
268
		}
269
	}
270
271
	/**
272
	 * @param Account $a
@@ 275-287 (lines=13) @@
272
	 * @param Account $a
273
	 * @param UserInterface $backend
274
	 */
275
	private function syncSearchTerms(Account $a, UserInterface $backend) {
276
		$uid = $a->getUserId();
277
		if ($backend instanceof IProvidesExtendedSearchBackend) {
278
			$searchTerms = $backend->getSearchTerms($uid);
279
			$a->setSearchTerms($searchTerms);
280
			if ($a->haveTermsChanged()) {
281
				$logTerms = implode('|', $searchTerms);
282
				$this->logger->debug(
283
					"Setting searchTerms for <$uid> to <$logTerms>", ['app' => self::class]
284
				);
285
			}
286
		}
287
	}
288
289
	/**
290
	 * @param Account $a