Code Duplication    Length = 10-14 lines in 4 locations

projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/gutenberg-available-extensions.php 1 location

@@ 25-34 (lines=10) @@
22
		add_action( 'rest_api_init', array( $this, 'register_routes' ) );
23
	}
24
25
	public function register_routes() {
26
		register_rest_route( $this->namespace, $this->rest_base . '/available-extensions', array(
27
			array(
28
				'methods'             => WP_REST_Server::READABLE,
29
				'callback'            => array( 'Jetpack_Gutenberg', 'get_availability' ),
30
				'permission_callback' => array( $this, 'get_items_permission_check' ),
31
			),
32
			'schema' => array( $this, 'get_item_schema' ),
33
		 ) );
34
	}
35
36
	/**
37
	 * Return the available Gutenberg extensions schema

projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/publicize-connection-test-results.php 1 location

@@ 23-36 (lines=14) @@
20
	/**
21
	 * Called automatically on `rest_api_init()`.
22
	 */
23
	public function register_routes() {
24
		register_rest_route(
25
			$this->namespace,
26
			'/' . $this->rest_base,
27
			array(
28
				array(
29
					'methods'             => WP_REST_Server::READABLE,
30
					'callback'            => array( $this, 'get_items' ),
31
					'permission_callback' => array( $this, 'get_items_permission_check' ),
32
				),
33
				'schema' => array( $this, 'get_public_item_schema' ),
34
			)
35
		);
36
	}
37
38
	/**
39
	 * Adds the test results properties to the Connection schema.

projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/publicize-connections.php 1 location

@@ 37-50 (lines=14) @@
34
	/**
35
	 * Called automatically on `rest_api_init()`.
36
	 */
37
	public function register_routes() {
38
		register_rest_route(
39
			$this->namespace,
40
			'/' . $this->rest_base,
41
			array(
42
				array(
43
					'methods'             => WP_REST_Server::READABLE,
44
					'callback'            => array( $this, 'get_items' ),
45
					'permission_callback' => array( $this, 'get_items_permission_check' ),
46
				),
47
				'schema' => array( $this, 'get_public_item_schema' ),
48
			)
49
		);
50
	}
51
52
	/**
53
	 * Helper for generating schema. Used by this endpoint and by the

projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-joltw.php 1 location

@@ 30-40 (lines=11) @@
27
	/**
28
	 * Register the route.
29
	 */
30
	public function register_routes() {
31
		register_rest_route($this->namespace, '/' . $this->rest_base . '/file(?P<path>/.+)?', [
32
			[
33
				'show_in_index' => false,
34
				'methods' => WP_REST_Server::READABLE,
35
				'callback' => [ $this, 'fetch_remote_media_file' ],
36
				'permission_callback' => [ $this, 'permission_check' ],
37
				'args' => [],
38
			],
39
		] );
40
	}
41
42
	public function permission_check( WP_REST_Request $request ) {
43
		return true;