\WP_REST_Server::EDITABLE, 'callback' => array( $this, 'save_options' ), 'permission_callback' => array( $this, 'user_is_able_to_admin_force_refresh' ), ), ); } /** * Method for saving options * * @param \WP_REST_Request $request The WP ReST request. * * @return void */ public function save_options( \WP_REST_Request $request ): void { $debug_mode = $request->get_param( 'debug' ) === true ?? null; Debug_Storage_Service::set_debug_mode( $debug_mode ); $this->return_api_response( 201, 'You\'ve successfully updated debug mode.' ); } /** * Method for getting the endpoint for this service. * * @return string The service endpoint. */ public static function get_rest_endpoint(): string { return self::get_formatted_rest_endpoint( self::ENDPOINT_PATH, self::ENDPOINT_VERSION ); } }