Code Duplication    Length = 7-7 lines in 2 locations

includes/api/class-wc-rest-webhooks-controller.php 2 locations

@@ 220-226 (lines=7) @@
217
		$webhook = new WC_Webhook( $id );
218
219
		// Update topic.
220
		if ( ! empty( $request['topic'] ) ) {
221
			if ( wc_is_webhook_valid_topic( strtolower( $request['topic'] ) ) ) {
222
				$webhook->set_topic( $request['topic'] );
223
			} else {
224
				return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_topic", __( 'Webhook topic must be valid.', 'woocommerce' ), array( 'status' => 400 ) );
225
			}
226
		}
227
228
		// Update delivery URL.
229
		if ( ! empty( $request['delivery_url'] ) ) {
@@ 229-235 (lines=7) @@
226
		}
227
228
		// Update delivery URL.
229
		if ( ! empty( $request['delivery_url'] ) ) {
230
			if ( wc_is_valid_url( $request['delivery_url'] ) ) {
231
				$webhook->set_delivery_url( $request['delivery_url'] );
232
			} else {
233
				return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http:// or https://.', 'woocommerce' ), array( 'status' => 400 ) );
234
			}
235
		}
236
237
		// Update secret.
238
		if ( ! empty( $request['secret'] ) ) {