Code Duplication    Length = 18-20 lines in 2 locations

lib/private/User/SyncService.php 2 locations

@@ 173-190 (lines=18) @@
170
	 * @param Account $a
171
	 * @param UserInterface $backend
172
	 */
173
	private function syncEmail(Account $a, UserInterface $backend) {
174
		$uid = $a->getUserId();
175
		$email = null;
176
		if ($backend instanceof IProvidesEMailBackend) {
177
			$email = $backend->getEMailAddress($uid);
178
			$a->setEmail($email);
179
		} else {
180
			list($hasKey, $email) = $this->readUserConfig($uid, 'settings', 'email');
181
			if ($hasKey) {
182
				$a->setEmail($email);
183
			}
184
		}
185
		if (array_key_exists('email', $a->getUpdatedFields())) {
186
			$this->logger->debug(
187
				"Setting email for <$uid> to <$email>", ['app' => self::class]
188
			);
189
		}
190
	}
191
192
	/**
193
	 * @param Account $a
@@ 196-215 (lines=20) @@
193
	 * @param Account $a
194
	 * @param UserInterface $backend
195
	 */
196
	private function syncQuota(Account $a, UserInterface $backend) {
197
		$uid = $a->getUserId();
198
		$quota = null;
199
		if ($backend instanceof IProvidesQuotaBackend) {
200
			$quota = $backend->getQuota($uid);
201
			if ($quota !== null) {
202
				$a->setQuota($quota);
203
			}
204
		} else {
205
			list($hasKey, $quota) = $this->readUserConfig($uid, 'files', 'quota');
206
			if ($hasKey) {
207
				$a->setQuota($quota);
208
			}
209
		}
210
		if (array_key_exists('quota', $a->getUpdatedFields())) {
211
			$this->logger->debug(
212
				"Setting quota for <$uid> to <$quota>", ['app' => self::class]
213
			);
214
		}
215
	}
216
217
	/**
218
	 * @param Account $a