Code Duplication    Length = 4-9 lines in 2 locations

class.jetpack-cli.php 2 locations

@@ 129-132 (lines=4) @@
126
			Jetpack_Client::WPCOM_JSON_API_VERSION
127
		);
128
129
		if ( is_wp_error( $response ) ) {
130
			/* translators: %1$s is the error code, %2$s is the error message */
131
			WP_CLI::error( sprintf( __( 'Failed to test connection (#%1$s: %2$s)', 'jetpack' ), $response->get_error_code(), $response->get_error_message() ) );
132
		}
133
134
		$body = wp_remote_retrieve_body( $response );
135
		if ( ! $body ) {
@@ 1129-1137 (lines=9) @@
1126
			$named_args['base_api_path']
1127
		);
1128
1129
		if ( is_wp_error( $response ) ) {
1130
			WP_CLI::error( sprintf(
1131
				/* translators: %1$s is an endpoint route (ex. /sites/123456), %2$d is an error code, %3$s is an error message. */
1132
				__( 'Request to %1$s returned an error: (%2$d) %3$s.', 'jetpack' ),
1133
				$resource_url,
1134
				$response->get_error_code(),
1135
				$response->get_error_message()
1136
			) );
1137
		}
1138
1139
		if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
1140
			WP_CLI::error( sprintf(