Code Duplication    Length = 7-7 lines in 3 locations

class.jetpack-network.php 1 location

@@ 430-436 (lines=7) @@
427
		// Save the secrets in the subsite so when the wpcom server does a pingback it
428
		// will be able to validate the connection
429
		$secrets = $jp->generate_secrets( 'register' );
430
		if (
431
			empty( $secrets['secret_1'] ) ||
432
			empty( $secrets['secret_2']  ) ||
433
			empty( $secrets['exp'] )
434
		) {
435
			return new Jetpack_Error( 'missing_secrets' );
436
		}
437
438
		// Gra info for gmt offset
439
		$gmt_offset = get_option( 'gmt_offset' );

class.jetpack.php 1 location

@@ 5052-5058 (lines=7) @@
5049
		add_action( 'pre_update_jetpack_option_register', array( 'Jetpack_Options', 'delete_option' ) );
5050
		$secrets = Jetpack::generate_secrets( 'register' );
5051
5052
		if (
5053
			empty( $secrets['secret_1'] ) ||
5054
			empty( $secrets['secret_2'] ) ||
5055
			empty( $secrets['exp'] )
5056
		) {
5057
			return new Jetpack_Error( 'missing_secrets' );
5058
		}
5059
5060
		// better to try (and fail) to set a higher timeout than this system
5061
		// supports than to have register fail for more users than it should

packages/connection/src/Manager.php 1 location

@@ 145-151 (lines=7) @@
142
		add_action( 'pre_update_jetpack_option_register', array( '\Jetpack_Options', 'delete_option' ) );
143
		$secrets = $this->generate_secrets( 'register', get_current_user_id(), 600 );
144
145
		if (
146
			empty( $secrets['secret_1'] ) ||
147
			empty( $secrets['secret_2'] ) ||
148
			empty( $secrets['exp'] )
149
		) {
150
			return new \WP_Error( 'missing_secrets' );
151
		}
152
153
		// better to try (and fail) to set a higher timeout than this system
154
		// supports than to have register fail for more users than it should