Code Duplication    Length = 4-4 lines in 4 locations

projects/plugins/jetpack/class.jetpack-cli.php 4 locations

@@ 195-198 (lines=4) @@
192
		}
193
194
		$action = isset( $args[0] ) ? $args[0] : 'prompt';
195
		if ( ! in_array( $action, array( 'blog', 'user', 'prompt' ) ) ) {
196
			/* translators: %s is a command like "prompt" */
197
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
198
		}
199
200
		if ( in_array( $action, array( 'user' ) ) ) {
201
			if ( isset( $args[1] ) ) {
@@ 285-288 (lines=4) @@
282
	 */
283
	public function reset( $args, $assoc_args ) {
284
		$action = isset( $args[0] ) ? $args[0] : 'prompt';
285
		if ( ! in_array( $action, array( 'options', 'modules', 'sync-checksum' ), true ) ) {
286
			/* translators: %s is a command like "prompt" */
287
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
288
		}
289
290
		$is_dry_run = ! empty( $assoc_args['dry-run'] );
291
@@ 594-597 (lines=4) @@
591
	 */
592
	public function protect( $args, $assoc_args ) {
593
		$action = isset( $args[0] ) ? $args[0] : 'prompt';
594
		if ( ! in_array( $action, array( 'whitelist', 'allow' ), true ) ) { // Still allow "whitelist" for legacy support.
595
			/* translators: %s is a command like "prompt" */
596
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
597
		}
598
		// Check if module is active
599
		if ( ! Jetpack::is_module_active( __FUNCTION__ ) ) {
600
			/* translators: %s is a module name */
@@ 726-729 (lines=4) @@
723
		// Is the option flagged as unsafe?
724
		$flagged = ! in_array( $args[1], $safe_to_modify );
725
726
		if ( ! in_array( $action, array( 'list', 'get', 'delete', 'update' ) ) ) {
727
			/* translators: %s is a command like "prompt" */
728
			WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) );
729
		}
730
731
		if ( isset( $args[0] ) ) {
732
			if ( 'get' == $args[0] && isset( $args[1] ) ) {