Code Duplication    Length = 5-5 lines in 2 locations

includes/api/class-wc-rest-orders-controller.php 1 location

@@ 377-381 (lines=5) @@
374
			);
375
		}
376
377
		if ( 0 !== (int) $order->post->post_parent ) {
378
			$links['up'] = array(
379
				'href' => rest_url( sprintf( '/%s/orders/%d', $this->namespace, $order->post->post_parent ) ),
380
			);
381
		}
382
383
		return $links;
384
	}

includes/api/class-wc-rest-products-controller.php 1 location

@@ 610-614 (lines=5) @@
607
			$links['up'] = array(
608
				'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $product->parent ) ),
609
			);
610
		} elseif ( $product->is_type( 'simple' ) && ! empty( $product->post->post_parent ) ) {
611
			$links['up'] = array(
612
				'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $product->post->post_parent ) ),
613
			);
614
		}
615
616
		return $links;
617
	}