Code Duplication    Length = 23-23 lines in 2 locations

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

@@ 42-64 (lines=23) @@
39
	/**
40
	 * Register the routes for product reviews.
41
	 */
42
	public function register_routes() {
43
		register_rest_route( $this->namespace, '/' . $this->rest_base, array(
44
			array(
45
				'methods'             => WP_REST_Server::READABLE,
46
				'callback'            => array( $this, 'get_items' ),
47
				'permission_callback' => array( $this, 'get_items_permissions_check' ),
48
				'args'                => $this->get_collection_params(),
49
			),
50
			'schema' => array( $this, 'get_public_item_schema' ),
51
		) );
52
53
		register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
54
			array(
55
				'methods'             => WP_REST_Server::READABLE,
56
				'callback'            => array( $this, 'get_item' ),
57
				'permission_callback' => array( $this, 'get_item_permissions_check' ),
58
				'args'                => array(
59
					'context' => $this->get_context_param( array( 'default' => 'view' ) ),
60
				),
61
			),
62
			'schema' => array( $this, 'get_public_item_schema' ),
63
		) );
64
	}
65
66
	/**
67
	 * Check whether a given request has permission to read webhook deliveries.

includes/api/class-wc-rest-webhook-deliveries.php 1 location

@@ 42-64 (lines=23) @@
39
	/**
40
	 * Register the routes for webhook deliveries.
41
	 */
42
	public function register_routes() {
43
		register_rest_route( $this->namespace, '/' . $this->rest_base, array(
44
			array(
45
				'methods'             => WP_REST_Server::READABLE,
46
				'callback'            => array( $this, 'get_items' ),
47
				'permission_callback' => array( $this, 'get_items_permissions_check' ),
48
				'args'                => $this->get_collection_params(),
49
			),
50
			'schema' => array( $this, 'get_public_item_schema' ),
51
		) );
52
53
		register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
54
			array(
55
				'methods'             => WP_REST_Server::READABLE,
56
				'callback'            => array( $this, 'get_item' ),
57
				'permission_callback' => array( $this, 'get_item_permissions_check' ),
58
				'args'                => array(
59
					'context' => $this->get_context_param( array( 'default' => 'view' ) ),
60
				),
61
			),
62
			'schema' => array( $this, 'get_public_item_schema' ),
63
		) );
64
	}
65
66
	/**
67
	 * Check whether a given request has permission to read webhook deliveries.