Code Duplication    Length = 18-20 lines in 2 locations

lib/private/User/SyncService.php 2 locations

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