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
@@ 164-185 (lines=22) @@
161
		$instanceUrl = $this->urlGenerator->getAbsoluteURL('/');
162
163
		$actor = $this->userSession->getUser();
164
		if ($actor instanceof IUser) {
165
			if ($actor->getUID() !== $user->getUID()) {
166
				$this->l = $this->languageFactory->get(
167
					'settings',
168
					$this->config->getUserValue(
169
						$user->getUID(), 'core', 'lang',
170
						$this->config->getSystemValue('default_language', 'en')
171
					)
172
				);
173
174
				$text = $this->l->t('%1$s changed your email address on %2$s.', [$actor->getDisplayName(), $instanceUrl]);
175
				$event->setAuthor($actor->getUID())
176
					->setSubject(Provider::EMAIL_CHANGED_BY, [$actor->getUID()]);
177
			} else {
178
				$text = $this->l->t('Your email address on %s was changed.', [$instanceUrl]);
179
				$event->setAuthor($actor->getUID())
180
					->setSubject(Provider::EMAIL_CHANGED_SELF);
181
			}
182
		} else {
183
			$text = $this->l->t('Your email address on %s was changed by an administrator.', [$instanceUrl]);
184
			$event->setSubject(Provider::EMAIL_CHANGED);
185
		}
186
		$this->activityManager->publish($event);
187
188