Code Duplication    Length = 11-13 lines in 2 locations

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

@@ 499-511 (lines=13) @@
496
	 * @param object $attribute Attribute object.
497
	 * @return array Links for the given attribute.
498
	 */
499
	protected function prepare_links( $attribute ) {
500
		$base  = '/' . $this->namespace . '/' . $this->rest_base;
501
		$links = array(
502
			'self' => array(
503
				'href' => rest_url( trailingslashit( $base ) . $attribute->attribute_id ),
504
			),
505
			'collection' => array(
506
				'href' => rest_url( $base ),
507
			),
508
		);
509
510
		return $links;
511
	}
512
513
	/**
514
	 * Get the Attribute's schema, conforming to JSON Schema.

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

@@ 82-92 (lines=11) @@
79
	 * @param string $group_id Group ID.
80
	 * @return array Links for the given group.
81
	 */
82
	protected function prepare_links( $group_id ) {
83
		$base  = '/' . $this->namespace . '/' . $this->rest_base;
84
		$links = array(
85
			'item' => array(
86
				'href'       => rest_url( trailingslashit( $base ) . $group_id ),
87
				'embeddable' => true,
88
			),
89
		);
90
91
		return $links;
92
	}
93
94
	/**
95
	 * Prepare a report sales object for serialization.