Code Duplication    Length = 13-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-options-controller.php 1 location

@@ 248-260 (lines=13) @@
245
	 * @param string $group_id Group ID.
246
	 * @return array Links for the given setting.
247
	 */
248
	protected function prepare_links( $setting_id, $group_id ) {
249
		$base  = '/' . $this->namespace . '/' . $this->rest_base . '/' . $group_id;
250
		$links = array(
251
			'self' => array(
252
				'href' => rest_url( trailingslashit( $base ) . $setting_id ),
253
			),
254
			'collection' => array(
255
				'href' => rest_url( $base ),
256
			),
257
		);
258
259
		return $links;
260
	}
261
262
	/**
263
	 * Get the settings schema, conforming to JSON Schema.