Code Duplication    Length = 18-23 lines in 2 locations

lib/Command/CirclesRemote.php 2 locations

@@ 251-268 (lines=18) @@
248
	 * @param OutputInterface $output
249
	 * @param AppService $remoteSignatory
250
	 */
251
	private function saveRemote(InputInterface $input, OutputInterface $output, AppService $remoteSignatory) {
252
		$output->writeln('');
253
		$helper = $this->getHelper('question');
254
255
		$output->writeln(
256
			'The remote instance <info>' . $remoteSignatory->getInstance() . '</info> looks good.'
257
		);
258
		$question = new ConfirmationQuestion(
259
			'Would you like to allow the sharing of your circles with this remote instance ? (y/N) ',
260
			false,
261
			'/^(y|Y)/i'
262
		);
263
264
		if ($helper->ask($input, $output, $question)) {
265
			$this->remoteService->save($remoteSignatory);
266
			$output->writeln('<info>remote instance saved</info>');
267
		}
268
	}
269
270
271
	/**
@@ 276-298 (lines=23) @@
273
	 * @param OutputInterface $output
274
	 * @param AppService $remoteSignatory
275
	 */
276
	private function updateRemote(InputInterface $input, OutputInterface $output, AppService $remoteSignatory
277
	) {
278
		$output->writeln('');
279
		$helper = $this->getHelper('question');
280
281
		$output->writeln(
282
			'The remote instance <info>' . $remoteSignatory->getInstance()
283
			. '</info> is known but <error>its identity has changed.</error>'
284
		);
285
		$output->writeln(
286
			'<comment>If you are not sure on why identity changed, please say No to the next question and contact the admin of the remote instance</comment>'
287
		);
288
		$question = new ConfirmationQuestion(
289
			'Do you consider this new identity as valid and update the entry in the database? (y/N) ',
290
			false,
291
			'/^(y|Y)/i'
292
		);
293
294
		if ($helper->ask($input, $output, $question)) {
295
			$this->remoteService->update($remoteSignatory);
296
			$output->writeln('remote instance updated');
297
		}
298
	}
299
300
301
}