Code Duplication    Length = 4-9 lines in 2 locations

class.jetpack-cli.php 2 locations

@@ 141-144 (lines=4) @@
138
			Client::WPCOM_JSON_API_VERSION
139
		);
140
141
		if ( is_wp_error( $response ) ) {
142
			/* translators: %1$s is the error code, %2$s is the error message */
143
			WP_CLI::error( sprintf( __( 'Failed to test connection (#%1$s: %2$s)', 'jetpack' ), $response->get_error_code(), $response->get_error_message() ) );
144
		}
145
146
		$body = wp_remote_retrieve_body( $response );
147
		if ( ! $body ) {
@@ 1355-1363 (lines=9) @@
1352
			empty( $named_args['base_api_path'] ) ? 'rest' : $named_args['base_api_path']
1353
		);
1354
1355
		if ( is_wp_error( $response ) ) {
1356
			WP_CLI::error(
1357
				sprintf(
1358
					/* translators: %1$s is an endpoint route (ex. /sites/123456), %2$d is an error code, %3$s is an error message. */
1359
					__( 'Request to %1$s returned an error: (%2$d) %3$s.', 'jetpack' ),
1360
					$resource_url,
1361
					$response->get_error_code(),
1362
					$response->get_error_message()
1363
				)
1364
			);
1365
		}
1366