Code Duplication    Length = 8-10 lines in 2 locations

settings/Controller/UsersController.php 2 locations

@@ 833-840 (lines=8) @@
830
		// address
831
		$oldDisplayName = $user->getDisplayName();
832
		$oldDisplayName = is_null($oldDisplayName) ? '' : $oldDisplayName;
833
		if (isset($data[AccountManager::PROPERTY_DISPLAYNAME]['value'])
834
			&& $oldDisplayName !== $data[AccountManager::PROPERTY_DISPLAYNAME]['value']
835
		) {
836
			$result = $user->setDisplayName($data[AccountManager::PROPERTY_DISPLAYNAME]['value']);
837
			if ($result === false) {
838
				throw new ForbiddenException($this->l10n->t('Unable to change full name'));
839
			}
840
		}
841
842
		$oldEmailAddress = $user->getEMailAddress();
843
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
@@ 844-853 (lines=10) @@
841
842
		$oldEmailAddress = $user->getEMailAddress();
843
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
844
		if (isset($data[AccountManager::PROPERTY_EMAIL]['value'])
845
			&& $oldEmailAddress !== $data[AccountManager::PROPERTY_EMAIL]['value']
846
		) {
847
			// this is the only permission a backend provides and is also used
848
			// for the permission of setting a email address
849
			if (!$user->canChangeDisplayName()) {
850
				throw new ForbiddenException($this->l10n->t('Unable to change email address'));
851
			}
852
			$user->setEMailAddress($data[AccountManager::PROPERTY_EMAIL]['value']);
853
		}
854
855
		$this->accountManager->updateUser($user, $data);
856
	}