Code Duplication    Length = 10-11 lines in 3 locations

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

@@ 49-59 (lines=11) @@
46
	/**
47
	 * Register the routes for sales reports.
48
	 */
49
	public function register_routes() {
50
		register_rest_route( $this->namespace, '/' . $this->rest_base, array(
51
			array(
52
				'methods'             => WP_REST_Server::READABLE,
53
				'callback'            => array( $this, 'get_items' ),
54
				'permission_callback' => array( $this, 'get_items_permissions_check' ),
55
				'args'                => $this->get_collection_params(),
56
			),
57
			'schema' => array( $this, 'get_public_item_schema' ),
58
		) );
59
	}
60
61
	/**
62
	 * Check whether a given request has permission to read report.

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

@@ 42-52 (lines=11) @@
39
	/**
40
	 * Register the routes for reports.
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
54
	/**
55
	 * Check whether a given request has permission to read reports.

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

@@ 27-36 (lines=10) @@
24
	 * Register routes.
25
	 * @since 2.7.0
26
	 */
27
	public function register_routes() {
28
		register_rest_route( $this->namespace, '/' . $this->rest_base, array(
29
			array(
30
				'methods'             => WP_REST_Server::READABLE,
31
				'callback'            => array( $this, 'get_items' ),
32
				'permission_callback' => array( $this, 'permissions_check' ),
33
			),
34
			'schema' => array( $this, 'get_public_item_schema' ),
35
		) );
36
	}
37
38
	/**
39
	 * Get all settings groups items.