} /** * Set the Endpoint's namespace. * * @param string $api_namespace The namespace. * @return void */ protected function set_namespace( string $api_namespace = '' ): void { $this->namespace = $api_namespace; } /** * Get the Endpoint's endpoint part * * @return string */ public function get_endpoint(): string { return $this->endpoint; } /** * Gives the full url of the Rest endpoint (with site url). * * @return string */ public function get_endpoint_url(): string { return trailingslashit( rest_url() ) . trailingslashit( $this->get_namespace() ) . $this->get_endpoint(); } /** * Gives the path of the Rest endpoint without site url * * @return string */ public function get_endpoint_path(): string { return trailingslashit( $this->get_namespace() ) . $this->get_endpoint(); } /** * Register the routes for the objects of the controller. This should be defined in extending class. * * @since 1.0.0 * * @return void */ public function register_routes(): void { } /** * A helper function called early to allow prepare some variables * * @since 1.0.0 * * @return void */ public function prepare_endpoint_params(): void { } }