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

@@ 412-419 (lines=8) @@
409
				 * Done here because it's easier to read the $whitelist array after it's been rebuilt
410
				 */
411
				if ( isset( $args[1] ) && 'list' == $args[1] ) {
412
					if ( ! empty( $whitelist ) ) {
413
						WP_CLI::success( __( 'Here are your whitelisted IPs:', 'jetpack' ) );
414
						foreach ( $whitelist as $ip ) {
415
							WP_CLI::line( "\t" . str_pad( $ip, 24 ) ) ;
416
						}
417
					} else {
418
						WP_CLI::line( __( 'Whitelist is empty.', "jetpack" ) ) ;
419
					}
420
					break;
421
				}
422
@@ 660-664 (lines=5) @@
657
658
				// Kick off a full sync
659
				if ( Jetpack_Sync_Actions::do_full_sync( $modules ) ) {
660
					if ( $modules ) {
661
						WP_CLI::log( sprintf( __( 'Initialized a new full sync with modules: %s', 'jetpack' ), join( ', ', array_keys( $modules ) ) ) );
662
					} else {
663
						WP_CLI::log( __( 'Initialized a new full sync', 'jetpack' ) );
664
					}
665
				} else {
666
667
					// Reset sync settings to original.
@@ 665-675 (lines=11) @@
662
					} else {
663
						WP_CLI::log( __( 'Initialized a new full sync', 'jetpack' ) );
664
					}
665
				} else {
666
667
					// Reset sync settings to original.
668
					Jetpack_Sync_Settings::update_settings( $original_settings );
669
670
					if ( $modules ) {
671
						WP_CLI::error( sprintf( __( 'Could not start a new full sync with modules: %s', 'jetpack' ), join( ', ', $modules ) ) );
672
					} else {
673
						WP_CLI::error( __( 'Could not start a new full sync', 'jetpack' ) );
674
					}
675
				}
676
677
				// Keep sending to WPCOM until there's nothing to send
678
				$i = 1;