Code Duplication    Length = 8-10 lines in 2 locations

settings/Controller/UsersController.php 2 locations

@@ 609-616 (lines=8) @@
606
		// address
607
		$oldDisplayName = $user->getDisplayName();
608
		$oldDisplayName = is_null($oldDisplayName) ? '' : $oldDisplayName;
609
		if (isset($data[AccountManager::PROPERTY_DISPLAYNAME]['value'])
610
			&& $oldDisplayName !== $data[AccountManager::PROPERTY_DISPLAYNAME]['value']
611
		) {
612
			$result = $user->setDisplayName($data[AccountManager::PROPERTY_DISPLAYNAME]['value']);
613
			if ($result === false) {
614
				throw new ForbiddenException($this->l10n->t('Unable to change full name'));
615
			}
616
		}
617
618
		$oldEmailAddress = $user->getEMailAddress();
619
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
@@ 620-629 (lines=10) @@
617
618
		$oldEmailAddress = $user->getEMailAddress();
619
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
620
		if (isset($data[AccountManager::PROPERTY_EMAIL]['value'])
621
			&& $oldEmailAddress !== $data[AccountManager::PROPERTY_EMAIL]['value']
622
		) {
623
			// this is the only permission a backend provides and is also used
624
			// for the permission of setting a email address
625
			if (!$user->canChangeDisplayName()) {
626
				throw new ForbiddenException($this->l10n->t('Unable to change email address'));
627
			}
628
			$user->setEMailAddress($data[AccountManager::PROPERTY_EMAIL]['value']);
629
		}
630
631
		$this->accountManager->updateUser($user, $data);
632
	}