Code Duplication    Length = 8-10 lines in 2 locations

settings/Controller/UsersController.php 2 locations

@@ 791-798 (lines=8) @@
788
		// address
789
		$oldDisplayName = $user->getDisplayName();
790
		$oldDisplayName = is_null($oldDisplayName) ? '' : $oldDisplayName;
791
		if (isset($data[AccountManager::PROPERTY_DISPLAYNAME]['value'])
792
			&& $oldDisplayName !== $data[AccountManager::PROPERTY_DISPLAYNAME]['value']
793
		) {
794
			$result = $user->setDisplayName($data[AccountManager::PROPERTY_DISPLAYNAME]['value']);
795
			if ($result === false) {
796
				throw new ForbiddenException($this->l10n->t('Unable to change full name'));
797
			}
798
		}
799
800
		$oldEmailAddress = $user->getEMailAddress();
801
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
@@ 802-811 (lines=10) @@
799
800
		$oldEmailAddress = $user->getEMailAddress();
801
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
802
		if (isset($data[AccountManager::PROPERTY_EMAIL]['value'])
803
			&& $oldEmailAddress !== $data[AccountManager::PROPERTY_EMAIL]['value']
804
		) {
805
			// this is the only permission a backend provides and is also used
806
			// for the permission of setting a email address
807
			if (!$user->canChangeDisplayName()) {
808
				throw new ForbiddenException($this->l10n->t('Unable to change email address'));
809
			}
810
			$user->setEMailAddress($data[AccountManager::PROPERTY_EMAIL]['value']);
811
		}
812
813
		$this->accountManager->updateUser($user, $data);
814
	}