Code Duplication    Length = 4-4 lines in 4 locations

class.jetpack-cli.php 4 locations

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