Code Duplication    Length = 5-11 lines in 4 locations

modules/videopress/class.videopress-cli.php 1 location

@@ 59-64 (lines=6) @@
56
			$schedules = wp_get_schedules();
57
58
59
			if ( count( $crons ) === 0 ) {
60
				WP_CLI::success( __( 'Found no available cron jobs.', 'jetpack' ) );
61
62
			} else {
63
				WP_CLI::success( sprintf( _n( 'Found %d available cron job.', 'Found %d available cron jobs.', count( $crons ), 'jetpack' ), count( $crons ) ) );
64
			}
65
66
			foreach ( $crons as $cron_name => $cron ) {
67
				$interval = isset( $schedules[ $cron['interval'] ]['display'] ) ? $schedules[ $cron['interval'] ]['display'] : $cron['interval'];

class.jetpack-cli.php 3 locations

@@ 454-461 (lines=8) @@
451
				 * Done here because it's easier to read the $whitelist array after it's been rebuilt
452
				 */
453
				if ( isset( $args[1] ) && 'list' == $args[1] ) {
454
					if ( ! empty( $whitelist ) ) {
455
						WP_CLI::success( __( 'Here are your whitelisted IPs:', 'jetpack' ) );
456
						foreach ( $whitelist as $ip ) {
457
							WP_CLI::line( "\t" . str_pad( $ip, 24 ) ) ;
458
						}
459
					} else {
460
						WP_CLI::line( __( 'Whitelist is empty.', "jetpack" ) ) ;
461
					}
462
					break;
463
				}
464
@@ 702-706 (lines=5) @@
699
700
				// Kick off a full sync
701
				if ( Jetpack_Sync_Actions::do_full_sync( $modules ) ) {
702
					if ( $modules ) {
703
						WP_CLI::log( sprintf( __( 'Initialized a new full sync with modules: %s', 'jetpack' ), join( ', ', array_keys( $modules ) ) ) );
704
					} else {
705
						WP_CLI::log( __( 'Initialized a new full sync', 'jetpack' ) );
706
					}
707
				} else {
708
709
					// Reset sync settings to original.
@@ 707-717 (lines=11) @@
704
					} else {
705
						WP_CLI::log( __( 'Initialized a new full sync', 'jetpack' ) );
706
					}
707
				} else {
708
709
					// Reset sync settings to original.
710
					Jetpack_Sync_Settings::update_settings( $original_settings );
711
712
					if ( $modules ) {
713
						WP_CLI::error( sprintf( __( 'Could not start a new full sync with modules: %s', 'jetpack' ), join( ', ', $modules ) ) );
714
					} else {
715
						WP_CLI::error( __( 'Could not start a new full sync', 'jetpack' ) );
716
					}
717
				}
718
719
				// Keep sending to WPCOM until there's nothing to send
720
				$i = 1;