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] ) ) {
@@ 269-272 (lines=4) @@
266
	 */
267
	public function reset( $args, $assoc_args ) {
268
		$action = isset( $args[0] ) ? $args[0] : 'prompt';
269
		if ( ! in_array( $action, array( 'options', 'modules', 'sync-checksum' ), true ) ) {
270
			/* translators: %s is a command like "prompt" */
271
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
272
		}
273
274
		$is_dry_run = ! empty( $assoc_args['dry-run'] );
275
@@ 571-574 (lines=4) @@
568
	 */
569
	public function protect( $args, $assoc_args ) {
570
		$action = isset( $args[0] ) ? $args[0] : 'prompt';
571
		if ( ! in_array( $action, array( 'whitelist' ) ) ) {
572
			/* translators: %s is a command like "prompt" */
573
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
574
		}
575
		// Check if module is active
576
		if ( ! Jetpack::is_module_active( __FUNCTION__ ) ) {
577
			/* translators: %s is a module name */
@@ 703-706 (lines=4) @@
700
		// Is the option flagged as unsafe?
701
		$flagged = ! in_array( $args[1], $safe_to_modify );
702
703
		if ( ! in_array( $action, array( 'list', 'get', 'delete', 'update' ) ) ) {
704
			/* translators: %s is a command like "prompt" */
705
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
706
		}
707
708
		if ( isset( $args[0] ) ) {
709
			if ( 'get' == $args[0] && isset( $args[1] ) ) {