Code Duplication    Length = 18-20 lines in 2 locations

lib/private/User/SyncService.php 2 locations

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