Code Duplication    Length = 4-4 lines in 4 locations

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