Code Duplication    Length = 10-11 lines in 4 locations

core/Command/User/SyncBackend.php 4 locations

@@ 151-161 (lines=11) @@
148
		} else {
149
			$output->writeln("Following users are no longer known with the connected backend.");
150
			switch ($missingAccountsAction) {
151
				case 'disable':
152
					$output->writeln("Proceeding to disable the accounts");
153
					$this->doActionForAccountUids($toBeDeleted,
154
							function($uid, IUser $ac) use ($output) {
155
								$ac->setEnabled(false);
156
								$output->writeln($uid);
157
							},
158
							function($uid) use ($output) {
159
								$output->writeln($uid . " (unknown account for the user)");
160
							});
161
					break;
162
				case 'remove':
163
					$output->writeln("Proceeding to remove the accounts");
164
					$this->doActionForAccountUids($toBeDeleted,
@@ 162-172 (lines=11) @@
159
								$output->writeln($uid . " (unknown account for the user)");
160
							});
161
					break;
162
				case 'remove':
163
					$output->writeln("Proceeding to remove the accounts");
164
					$this->doActionForAccountUids($toBeDeleted,
165
							function($uid, IUser $ac) use ($output) {
166
								$ac->delete();
167
								$output->writeln($uid);
168
							},
169
							function($uid) use ($output) {
170
								$output->writeln($uid . " (unknown account for the user)");
171
							});
172
					break;
173
				case 'ask later':
174
					$output->writeln("listing the unknown accounts");
175
					$this->doActionForAccountUids($toBeDeleted,
@@ 192-201 (lines=10) @@
189
					$missingAccountsAction2 = $helper->ask($input, $output, $question);
190
					switch ($missingAccountsAction2) {
191
						// if "nothing" is selected, just ignore and finish
192
						case 'disable':
193
							$output->writeln("Proceeding to disable the accounts");
194
							$this->doActionForAccountUids($toBeDeleted,
195
									function($uid, IUser $ac) {
196
										$ac->setEnabled(false);
197
									},
198
									function($uid) use ($output) {
199
										$output->writeln($uid . " (unknown account for the user)");
200
									});
201
							break;
202
						case 'remove':
203
							$output->writeln("Proceeding to remove the accounts");
204
							$this->doActionForAccountUids($toBeDeleted,
@@ 202-211 (lines=10) @@
199
										$output->writeln($uid . " (unknown account for the user)");
200
									});
201
							break;
202
						case 'remove':
203
							$output->writeln("Proceeding to remove the accounts");
204
							$this->doActionForAccountUids($toBeDeleted,
205
									function($uid, IUser $ac) {
206
										$ac->delete();
207
									},
208
									function($uid) use ($output) {
209
										$output->writeln($uid . " (unknown account for the user)");
210
									});
211
							break;
212
					}
213
					break;
214
			}