Code Duplication    Length = 4-4 lines in 4 locations

class.jetpack-cli.php 4 locations

@@ 193-196 (lines=4) @@
190
		}
191
192
		$action = isset( $args[0] ) ? $args[0] : 'prompt';
193
		if ( ! in_array( $action, array( 'blog', 'user', 'prompt' ) ) ) {
194
			/* translators: %s is a command like "prompt" */
195
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
196
		}
197
198
		if ( in_array( $action, array( 'user' ) ) ) {
199
			if ( isset( $args[1] ) ) {
@@ 270-273 (lines=4) @@
267
	 */
268
	public function reset( $args, $assoc_args ) {
269
		$action = isset( $args[0] ) ? $args[0] : 'prompt';
270
		if ( ! in_array( $action, array( 'options', 'modules', 'sync-checksum' ), true ) ) {
271
			/* translators: %s is a command like "prompt" */
272
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
273
		}
274
275
		$is_dry_run = ! empty( $assoc_args['dry-run'] );
276
@@ 579-582 (lines=4) @@
576
	 */
577
	public function protect( $args, $assoc_args ) {
578
		$action = isset( $args[0] ) ? $args[0] : 'prompt';
579
		if ( ! in_array( $action, array( 'whitelist' ) ) ) {
580
			/* translators: %s is a command like "prompt" */
581
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
582
		}
583
		// Check if module is active
584
		if ( ! Jetpack::is_module_active( __FUNCTION__ ) ) {
585
			/* translators: %s is a module name */
@@ 711-714 (lines=4) @@
708
		// Is the option flagged as unsafe?
709
		$flagged = ! in_array( $args[1], $safe_to_modify );
710
711
		if ( ! in_array( $action, array( 'list', 'get', 'delete', 'update' ) ) ) {
712
			/* translators: %s is a command like "prompt" */
713
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
714
		}
715
716
		if ( isset( $args[0] ) ) {
717
			if ( 'get' == $args[0] && isset( $args[1] ) ) {