Code Duplication    Length = 22-22 lines in 2 locations

projects/packages/identity-crisis/src/class-rest-endpoints.php 1 location

@@ 92-113 (lines=22) @@
89
	 *
90
	 * @return bool | WP_Error True if option is properly set.
91
	 */
92
	public static function migrate_stats_and_subscribers() {
93
		if ( Jetpack_Options::get_option( 'sync_error_idc' ) && ! Jetpack_Options::delete_option( 'sync_error_idc' ) ) {
94
			return new WP_Error(
95
				'error_deleting_sync_error_idc',
96
				esc_html__( 'Could not delete sync error option.', 'jetpack' ),
97
				array( 'status' => 500 )
98
			);
99
		}
100
101
		if ( Jetpack_Options::get_option( 'migrate_for_idc' ) || Jetpack_Options::update_option( 'migrate_for_idc', true ) ) {
102
			return rest_ensure_response(
103
				array(
104
					'code' => 'success',
105
				)
106
			);
107
		}
108
		return new WP_Error(
109
			'error_setting_jetpack_migrate',
110
			esc_html__( 'Could not confirm migration.', 'jetpack' ),
111
			array( 'status' => 500 )
112
		);
113
	}
114
115
	/**
116
	 * This IDC resolution will disconnect the site and re-connect to a completely new

projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php 1 location

@@ 2153-2174 (lines=22) @@
2150
	 *
2151
	 * @return bool | WP_Error True if option is properly set.
2152
	 */
2153
	public static function migrate_stats_and_subscribers() {
2154
		if ( Jetpack_Options::get_option( 'sync_error_idc' ) && ! Jetpack_Options::delete_option( 'sync_error_idc' ) ) {
2155
			return new WP_Error(
2156
				'error_deleting_sync_error_idc',
2157
				esc_html__( 'Could not delete sync error option.', 'jetpack' ),
2158
				array( 'status' => 500 )
2159
			);
2160
		}
2161
2162
		if ( Jetpack_Options::get_option( 'migrate_for_idc' ) || Jetpack_Options::update_option( 'migrate_for_idc', true ) ) {
2163
			return rest_ensure_response(
2164
				array(
2165
					'code' => 'success',
2166
				)
2167
			);
2168
		}
2169
		return new WP_Error(
2170
			'error_setting_jetpack_migrate',
2171
			esc_html__( 'Could not confirm migration.', 'jetpack' ),
2172
			array( 'status' => 500 )
2173
		);
2174
	}
2175
2176
	/**
2177
	 * This IDC resolution will disconnect the site and re-connect to a completely new