Code Duplication    Length = 11-15 lines in 2 locations

packages/connection/src/class-manager.php 1 location

@@ 1192-1206 (lines=15) @@
1189
	 * @param array $args arguments that need to have the source added.
1190
	 * @return array $amended arguments.
1191
	 */
1192
	public static function apply_activation_source_to_args( $args ) {
1193
		list( $activation_source_name, $activation_source_keyword ) = get_option( 'jetpack_activation_source' );
1194
1195
		if ( $activation_source_name ) {
1196
			// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode
1197
			$args['_as'] = urlencode( $activation_source_name );
1198
		}
1199
1200
		if ( $activation_source_keyword ) {
1201
			// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode
1202
			$args['_ak'] = urlencode( $activation_source_keyword );
1203
		}
1204
1205
		return $args;
1206
	}
1207
1208
	/**
1209
	 * Returns the callable that would be used to generate secrets.

class.jetpack.php 1 location

@@ 5020-5030 (lines=11) @@
5017
		return self::connection()->get_assumed_site_creation_date();
5018
	}
5019
5020
	public static function apply_activation_source_to_args( &$args ) {
5021
		list( $activation_source_name, $activation_source_keyword ) = get_option( 'jetpack_activation_source' );
5022
5023
		if ( $activation_source_name ) {
5024
			$args['_as'] = urlencode( $activation_source_name );
5025
		}
5026
5027
		if ( $activation_source_keyword ) {
5028
			$args['_ak'] = urlencode( $activation_source_keyword );
5029
		}
5030
	}
5031
5032
	function build_reconnect_url( $raw = false ) {
5033
		$url = wp_nonce_url( self::admin_url( 'action=reconnect' ), 'jetpack-reconnect' );