Code Duplication    Length = 4-9 lines in 2 locations

class.jetpack-cli.php 2 locations

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