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

@@ 255-267 (lines=13) @@
252
	 * @param string $group_id Group ID.
253
	 * @return array Links for the given setting.
254
	 */
255
	protected function prepare_links( $setting_id, $group_id ) {
256
		$base  = '/' . $this->namespace . '/' . $this->rest_base . '/' . $group_id;
257
		$links = array(
258
			'self' => array(
259
				'href' => rest_url( trailingslashit( $base ) . $setting_id ),
260
			),
261
			'collection' => array(
262
				'href' => rest_url( $base ),
263
			),
264
		);
265
266
		return $links;
267
	}
268
269
	/**
270
	 * Makes sure the current user has access to READ the settings APIs.