Code Duplication    Length = 22-22 lines in 2 locations

settings/Hooks.php 2 locations

@@ 94-115 (lines=22) @@
91
		$instanceUrl = $this->urlGenerator->getAbsoluteURL('/');
92
93
		$actor = $this->userSession->getUser();
94
		if ($actor instanceof IUser) {
95
			if ($actor->getUID() !== $user->getUID()) {
96
				$this->l = $this->languageFactory->get(
97
					'settings',
98
					$this->config->getUserValue(
99
						$user->getUID(), 'core', 'lang',
100
						$this->config->getSystemValue('default_language', 'en')
101
					)
102
				);
103
104
				$text = $this->l->t('%1$s changed your password on %2$s.', [$actor->getDisplayName(), $instanceUrl]);
105
				$event->setAuthor($actor->getUID())
106
					->setSubject(Provider::PASSWORD_CHANGED_BY, [$actor->getUID()]);
107
			} else {
108
				$text = $this->l->t('Your password on %s was changed.', [$instanceUrl]);
109
				$event->setAuthor($actor->getUID())
110
					->setSubject(Provider::PASSWORD_CHANGED_SELF);
111
			}
112
		} else {
113
			$text = $this->l->t('Your password on %s was reset by an administrator.', [$instanceUrl]);
114
			$event->setSubject(Provider::PASSWORD_RESET);
115
		}
116
117
		$this->activityManager->publish($event);
118
@@ 165-186 (lines=22) @@
162
		$instanceUrl = $this->urlGenerator->getAbsoluteURL('/');
163
164
		$actor = $this->userSession->getUser();
165
		if ($actor instanceof IUser) {
166
			if ($actor->getUID() !== $user->getUID()) {
167
				$this->l = $this->languageFactory->get(
168
					'settings',
169
					$this->config->getUserValue(
170
						$user->getUID(), 'core', 'lang',
171
						$this->config->getSystemValue('default_language', 'en')
172
					)
173
				);
174
175
				$text = $this->l->t('%1$s changed your email address on %2$s.', [$actor->getDisplayName(), $instanceUrl]);
176
				$event->setAuthor($actor->getUID())
177
					->setSubject(Provider::EMAIL_CHANGED_BY, [$actor->getUID()]);
178
			} else {
179
				$text = $this->l->t('Your email address on %s was changed.', [$instanceUrl]);
180
				$event->setAuthor($actor->getUID())
181
					->setSubject(Provider::EMAIL_CHANGED_SELF);
182
			}
183
		} else {
184
			$text = $this->l->t('Your email address on %s was changed by an administrator.', [$instanceUrl]);
185
			$event->setSubject(Provider::EMAIL_CHANGED);
186
		}
187
		$this->activityManager->publish($event);
188
189