| @@ -187,11 +187,13 @@ | ||
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * Sends a request to the remote API. |
| 190 | 190 | * |
| 191 | - * Any error returned has its credentials stripped. | |
| 191 | + * Any error returned has its credentials stripped. Endpoints customize the | |
| 192 | + * request through the methods called here, rather than by overriding it. | |
| 192 | 193 | * |
| 193 | 194 | * @since 3.17.0 |
| 195 | + * @since 3.24.3 Made final. | |
| 194 | 196 | * |
| 195 | 197 | * @param string $method The HTTP method to use for the request. |
| 196 | 198 | * @param array<mixed> $query_args The query arguments to send to the remote API. |
| 197 | 199 | * @param array<mixed> $data The data to send in the request body. |
| @@ -196,9 +198,9 @@ | ||
| 196 | 198 | * @param array<mixed> $query_args The query arguments to send to the remote API. |
| 197 | 199 | * @param array<mixed> $data The data to send in the request body. |
| 198 | 200 | * @return WP_Error|array<mixed> The response from the remote API. |
| 199 | 201 | */ |
| 200 | - protected function request( string $method, array $query_args = array(), array $data = array() ) { | |
| 202 | + final protected function request( string $method, array $query_args = array(), array $data = array() ) { | |
| 201 | 203 | // Get the URL to send the request to. |
| 202 | 204 | $request_url = $this->get_endpoint_url( $query_args ); |
| 203 | 205 | |
| 204 | 206 | // Build the request options. |
| @@ -234,13 +236,14 @@ | ||
| 234 | 236 | * Its other messages and data are dropped, as `pre_http_request` and other |
| 235 | 237 | * filters can attach anything to it, including the request headers. |
| 236 | 238 | * |
| 237 | 239 | * @since 3.24.2 |
| 240 | + * @since 3.24.3 Made final. | |
| 238 | 241 | * |
| 239 | 242 | * @param WP_Error $error The transport error. |
| 240 | 243 | * @return WP_Error The error to relay to the caller. |
| 241 | 244 | */ |
| 242 | - protected function get_relayable_transport_error( WP_Error $error ): WP_Error { | |
| 245 | + final protected function get_relayable_transport_error( WP_Error $error ): WP_Error { | |
| 243 | 246 | return $this->strip_credentials_from_error( |
| 244 | 247 | new WP_Error( |
| 245 | 248 | $error->get_error_code(), |
| 246 | 249 | $error->get_error_message(), |
| @@ -291,13 +294,14 @@ | ||
| 291 | 294 | * Arguments are dropped by name rather than by value, so values altered by |
| 292 | 295 | * the URL builder are covered too. |
| 293 | 296 | * |
| 294 | 297 | * @since 3.24.2 |
| 298 | + * @since 3.24.3 Made final. | |
| 295 | 299 | * |
| 296 | 300 | * @param string $message The message to strip. |
| 297 | 301 | * @return string The message, without the credentials. |
| 298 | 302 | */ |
| 299 | - protected function strip_credentials( string $message ): string { | |
| 303 | + final protected function strip_credentials( string $message ): string { | |
| 300 | 304 | if ( '' === $message ) { |
| 301 | 305 | return $message; |
| 302 | 306 | } |
| 303 | 307 | |
| @@ -360,13 +364,14 @@ | ||
| 360 | 364 | /** |
| 361 | 365 | * Removes the credentials from every message held by an error. |
| 362 | 366 | * |
| 363 | 367 | * @since 3.24.2 |
| 368 | + * @since 3.24.3 Made final. | |
| 364 | 369 | * |
| 365 | 370 | * @param WP_Error $error The error to strip. |
| 366 | 371 | * @return WP_Error The error, without the credentials. |
| 367 | 372 | */ |
| 368 | - protected function strip_credentials_from_error( WP_Error $error ): WP_Error { | |
| 373 | + final protected function strip_credentials_from_error( WP_Error $error ): WP_Error { | |
| 369 | 374 | $codes = $error->get_error_codes(); |
| 370 | 375 | |
| 371 | 376 | if ( 0 === count( $codes ) ) { |
| 372 | 377 | return $error; |