Code Duplication    Length = 10-11 lines in 4 locations

core/Command/User/SyncBackend.php 4 locations

@@ 201-211 (lines=11) @@
198
		} else {
199
			$output->writeln("Following users are no longer known with the connected backend.");
200
			switch ($missingAccountsAction) {
201
				case 'disable':
202
					$output->writeln("Proceeding to disable the accounts");
203
					$this->doActionForAccountUids($toBeDeleted,
204
						function ($uid, IUser $ac) use ($output) {
205
							$ac->setEnabled(false);
206
							$output->writeln($uid);
207
						},
208
						function ($uid) use ($output) {
209
							$output->writeln($uid . " (unknown account for the user)");
210
						});
211
					break;
212
				case 'remove':
213
					$output->writeln("Proceeding to remove the accounts");
214
					$this->doActionForAccountUids($toBeDeleted,
@@ 212-222 (lines=11) @@
209
							$output->writeln($uid . " (unknown account for the user)");
210
						});
211
					break;
212
				case 'remove':
213
					$output->writeln("Proceeding to remove the accounts");
214
					$this->doActionForAccountUids($toBeDeleted,
215
						function ($uid, IUser $ac) use ($output) {
216
							$ac->delete();
217
							$output->writeln($uid);
218
						},
219
						function ($uid) use ($output) {
220
							$output->writeln($uid . " (unknown account for the user)");
221
						});
222
					break;
223
				case 'ask later':
224
					$output->writeln("listing the unknown accounts");
225
					$this->doActionForAccountUids($toBeDeleted,
@@ 242-251 (lines=10) @@
239
					$missingAccountsAction2 = $helper->ask($input, $output, $question);
240
					switch ($missingAccountsAction2) {
241
						// if "nothing" is selected, just ignore and finish
242
						case 'disable':
243
							$output->writeln("Proceeding to disable the accounts");
244
							$this->doActionForAccountUids($toBeDeleted,
245
								function ($uid, IUser $ac) {
246
									$ac->setEnabled(false);
247
								},
248
								function ($uid) use ($output) {
249
									$output->writeln($uid . " (unknown account for the user)");
250
								});
251
							break;
252
						case 'remove':
253
							$output->writeln("Proceeding to remove the accounts");
254
							$this->doActionForAccountUids($toBeDeleted,
@@ 252-261 (lines=10) @@
249
									$output->writeln($uid . " (unknown account for the user)");
250
								});
251
							break;
252
						case 'remove':
253
							$output->writeln("Proceeding to remove the accounts");
254
							$this->doActionForAccountUids($toBeDeleted,
255
								function ($uid, IUser $ac) {
256
									$ac->delete();
257
								},
258
								function ($uid) use ($output) {
259
									$output->writeln($uid . " (unknown account for the user)");
260
								});
261
							break;
262
					}
263
					break;
264
			}