Code Duplication    Length = 21-22 lines in 3 locations

src/wordlift/vocabulary/api/class-entity-rest-endpoint.php 2 locations

@@ 72-93 (lines=22) @@
69
	}
70
71
72
	private function register_undo_route() {
73
		register_rest_route(
74
			Api_Config::REST_NAMESPACE,
75
			'/entity/undo',
76
			array(
77
				'methods'             => WP_REST_Server::CREATABLE,
78
				'callback'            => array( $this, 'undo' ),
79
				'permission_callback' => function () {
80
					return current_user_can( 'manage_options' );
81
				},
82
				'args'                => array(
83
					'term_id' => array(
84
						'validate_callback' => function ( $param, $request, $key ) {
85
							return is_numeric( $param ) && $param;
86
						},
87
						'required'          => true,
88
					),
89
				),
90
			)
91
		);
92
	}
93
94
	private function register_accept_route() {
95
		$route = '/entity/accept';
96
		$this->register_entity_accept_or_reject_route( $route, array( $this, 'accept_entity' ) );
@@ 114-135 (lines=22) @@
111
		return $term_id;
112
	}
113
114
	private function register_nomatch_route() {
115
		register_rest_route(
116
			Api_Config::REST_NAMESPACE,
117
			'/entity/no_match',
118
			array(
119
				'methods'             => WP_REST_Server::CREATABLE,
120
				'callback'            => array( $this, 'mark_as_no_match' ),
121
				'permission_callback' => function () {
122
					return current_user_can( 'manage_options' );
123
				},
124
				'args'                => array(
125
					'term_id' => array(
126
						'validate_callback' => function ( $param, $request, $key ) {
127
							return is_numeric( $param ) && $param;
128
						},
129
						'required'          => true,
130
					),
131
				),
132
			)
133
		);
134
	}
135
136
137
	/**
138
	 * @param $accept_route

src/wordlift/videoobject/api/class-rest-controller.php 1 location

@@ 67-87 (lines=21) @@
64
65
	}
66
67
	private function register_get_all_videos_route() {
68
		register_rest_route(
69
			WL_REST_ROUTE_DEFAULT_NAMESPACE,
70
			'/videos',
71
			array(
72
				'methods'             => WP_REST_Server::CREATABLE,
73
				'callback'            => array( $this, 'get_all_videos' ),
74
				'permission_callback' => function () {
75
					return current_user_can( 'manage_options' );
76
				},
77
				'args'                => array(
78
					'post_id' => array(
79
						'validate_callback' => function ( $param, $request, $key ) {
80
							return is_numeric( $param ) && $param;
81
						},
82
						'required'          => true,
83
					),
84
				),
85
			)
86
		);
87
	}
88
89
	private function register_save_all_videos_route() {
90
		register_rest_route(