urlBuilder = $url_builder; $this->config = $config; add_action( 'wp', array( $this, 'process_query' ), - 1 ); add_filter( 'query_vars', array( $this, 'query_vars' ) ); } /** * @param $vars * * @return array */ public function query_vars( $vars ) { $endpoint_keys = $this->get_endpoint_keys(); if ( ! is_array( $endpoint_keys ) ) { $endpoint_keys = array(); } $vars = array_merge( $vars, $endpoint_keys ); return $vars; } /** * @return mixed */ abstract public function process_query(); /** * @return string */ abstract protected function get_endpoint_keys(); }