Code Duplication    Length = 22-22 lines in 2 locations

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

@@ 67-88 (lines=22) @@
64
	}
65
66
67
	private function register_undo_route() {
68
		register_rest_route(
69
			Api_Config::REST_NAMESPACE,
70
			'/entity/undo',
71
			array(
72
				'methods'             => WP_REST_Server::CREATABLE,
73
				'callback'            => array( $this, 'undo' ),
74
				'permission_callback' => function () {
75
					return current_user_can( 'manage_options' );
76
				},
77
				'args'                => array(
78
					'term_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_accept_route() {
90
		$route = '/entity/accept';
91
		$this->register_entity_accept_or_reject_route( $route, array( $this, 'accept_entity' ) );
@@ 108-129 (lines=22) @@
105
		return $term_id;
106
	}
107
108
	private function register_nomatch_route() {
109
		register_rest_route(
110
			Api_Config::REST_NAMESPACE,
111
			'/entity/no_match',
112
			array(
113
				'methods'             => WP_REST_Server::CREATABLE,
114
				'callback'            => array( $this, 'mark_as_no_match' ),
115
				'permission_callback' => function () {
116
					return current_user_can( 'manage_options' );
117
				},
118
				'args'                => array(
119
					'term_id' => array(
120
						'validate_callback' => function ( $param, $request, $key ) {
121
							return is_numeric( $param ) && $param;
122
						},
123
						'required'          => true,
124
					),
125
				),
126
			)
127
		);
128
	}
129
130
131
	/**
132
	 * @param $accept_route