Code Duplication    Length = 22-22 lines in 2 locations

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

@@ 93-114 (lines=22) @@
90
	}
91
92
93
	private function register_undo_route() {
94
		register_rest_route(
95
			Api_Config::REST_NAMESPACE,
96
			'/entity/undo',
97
			array(
98
				'methods'             => WP_REST_Server::CREATABLE,
99
				'callback'            => array( $this, 'undo' ),
100
				//@todo : review the permission level
101
				'permission_callback' => function () {
102
					return current_user_can( 'manage_options' );
103
				},
104
				'args'                => array(
105
					'term_id' => array(
106
						'validate_callback' => function ( $param, $request, $key ) {
107
							return is_numeric( $param ) && $param;
108
						},
109
						'required'          => true,
110
					),
111
				),
112
			)
113
		);
114
	}
115
116
	private function register_accept_route() {
117
		register_rest_route(
@@ 145-166 (lines=22) @@
142
		);
143
	}
144
145
	private function register_nomatch_route() {
146
		register_rest_route(
147
			Api_Config::REST_NAMESPACE,
148
			'/entity/no_match',
149
			array(
150
				'methods'             => WP_REST_Server::CREATABLE,
151
				'callback'            => array( $this, 'mark_as_no_match' ),
152
				//@todo : review the permission level
153
				'permission_callback' => function () {
154
					return current_user_can( 'manage_options' );
155
				},
156
				'args'                => array(
157
					'term_id' => array(
158
						'validate_callback' => function ( $param, $request, $key ) {
159
							return is_numeric( $param ) && $param;
160
						},
161
						'required'          => true,
162
					),
163
				),
164
			)
165
		);
166
	}
167
168
}