Code Duplication    Length = 3-4 lines in 3 locations

class.jetpack-cli.php 3 locations

@@ 234-236 (lines=3) @@
231
	 */
232
	public function reset( $args, $assoc_args ) {
233
		$action = isset( $args[0] ) ? $args[0] : 'prompt';
234
		if ( ! in_array( $action, array( 'options', 'modules' ) ) ) {
235
			/* translators: %s is a command like "prompt" */
236
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
237
		}
238
239
		// Are you sure?
@@ 533-535 (lines=3) @@
530
		// Is the option flagged as unsafe?
531
		$flagged = ! in_array( $args[1], $safe_to_modify );
532
533
		if ( ! in_array( $action, array( 'list', 'get', 'delete', 'update' ) ) ) {
534
			/* translators: %s is a command like "prompt" */
535
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
536
		}
537
538
		if ( isset( $args[0] ) ) {
@@ 315-318 (lines=4) @@
312
	 */
313
	public function module( $args, $assoc_args ) {
314
		$action = isset( $args[0] ) ? $args[0] : 'list';
315
		if ( ! in_array( $action, array( 'list', 'activate', 'deactivate', 'toggle' ) ) ) {
316
			/* translators: %s is a command like "prompt" */
317
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
318
		}
319
		if ( in_array( $action, array( 'activate', 'deactivate', 'toggle' ) ) ) {
320
			if ( isset( $args[1] ) ) {
321
				$module_slug = $args[1];