Code Duplication    Length = 12-12 lines in 3 locations

includes/abstracts/abstract-wc-rest-posts-controller.php 1 location

@@ 461-472 (lines=12) @@
458
	 * @param WP_Post $post Post object.
459
	 * @return array Links for the given post.
460
	 */
461
	protected function prepare_links( $post ) {
462
		$links = array(
463
			'self' => array(
464
				'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $post->ID ) ),
465
			),
466
			'collection' => array(
467
				'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ),
468
			),
469
		);
470
471
		return $links;
472
	}
473
474
	/**
475
	 * Determine the allowed query_vars for a get_items() response and

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

@@ 592-603 (lines=12) @@
589
	 * @param WP_User $customer Customer object.
590
	 * @return array Links for the given customer.
591
	 */
592
	protected function prepare_links( $customer ) {
593
		$links = array(
594
			'self' => array(
595
				'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $customer->ID ) ),
596
			),
597
			'collection' => array(
598
				'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ),
599
			),
600
		);
601
602
		return $links;
603
	}
604
605
	/**
606
	 * Get the Customer's schema, conforming to JSON Schema.

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

@@ 518-529 (lines=12) @@
515
	 * @param stdClass $tax Tax object.
516
	 * @return array Links for the given tax.
517
	 */
518
	protected function prepare_links( $tax ) {
519
		$links = array(
520
			'self' => array(
521
				'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $tax->tax_rate_id ) ),
522
			),
523
			'collection' => array(
524
				'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ),
525
			),
526
		);
527
528
		return $links;
529
	}
530
531
	/**
532
	 * Bulk update or create items.