Code Duplication    Length = 22-22 lines in 2 locations

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

@@ 71-92 (lines=22) @@
68
	}
69
70
71
	private function register_undo_route() {
72
		register_rest_route(
73
			Api_Config::REST_NAMESPACE,
74
			'/entity/undo',
75
			array(
76
				'methods'             => WP_REST_Server::CREATABLE,
77
				'callback'            => array( $this, 'undo' ),
78
				//@todo : review the permission level
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
		register_rest_route(
@@ 123-144 (lines=22) @@
120
		);
121
	}
122
123
	private function register_nomatch_route() {
124
		register_rest_route(
125
			Api_Config::REST_NAMESPACE,
126
			'/entity/no_match',
127
			array(
128
				'methods'             => WP_REST_Server::CREATABLE,
129
				'callback'            => array( $this, 'mark_as_no_match' ),
130
				//@todo : review the permission level
131
				'permission_callback' => function () {
132
					return current_user_can( 'manage_options' );
133
				},
134
				'args'                => array(
135
					'term_id' => array(
136
						'validate_callback' => function ( $param, $request, $key ) {
137
							return is_numeric( $param ) && $param;
138
						},
139
						'required'          => true,
140
					),
141
				),
142
			)
143
		);
144
	}
145
146
}