From f022ba528a97f61a219dd90231e87b9ea5003753 Mon Sep 17 00:00:00 2001 From: Burhan Nasir Date: Thu, 7 Mar 2024 18:57:34 +0500 Subject: [PATCH] Change variable name --- includes/api/class-bc-api.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/api/class-bc-api.php b/includes/api/class-bc-api.php index d45296f1..ba177454 100644 --- a/includes/api/class-bc-api.php +++ b/includes/api/class-bc-api.php @@ -96,10 +96,10 @@ public function get_last_error() { * * @param string $url the url to call * @param array $args the arguments to pass to the API call - * @param bool $cache_response whether or not to cache the response irrespective of the response code + * @param bool $cache_fail_response whether or not to cache the api response even if it's failed * @return array|false|mixed|WP_Error */ - private function cached_get( $url, $args, $cache_response = false ) { + private function cached_get( $url, $args, $cache_fail_response = false ) { global $bc_accounts; @@ -126,14 +126,14 @@ private function cached_get( $url, $args, $cache_response = false ) { * Filter whether to cache the api response. * * @since 2.8.5 - * @hook brightcove_cache_api_response - * @param {bool} $cache_response Whether to cache the response. + * @hook brightcove_cache_api_fail_response + * @param {bool} $cache_fail_response Whether to cache the response. * @param {string} $url The URL of the request. * @param {array} $args The arguments of the request. */ - $cache_response = apply_filters( 'brightcove_cache_api_response', $cache_response, $url, $args ); + $cache_fail_response = apply_filters( 'brightcove_cache_api_fail_response', $cache_fail_response, $url, $args ); - if ( in_array( wp_remote_retrieve_response_code( $request ), $successful_response_codes, true ) || $cache_response ) { + if ( in_array( wp_remote_retrieve_response_code( $request ), $successful_response_codes, true ) || $cache_fail_response ) { BC_Utility::set_cache_item( $transient_key, '', $request, $cache_time_in_seconds ); } } @@ -151,11 +151,11 @@ private function cached_get( $url, $args, $cache_response = false ) { * @param string $method the http method to use * @param array $data array of further data to send to the server * @param boolean $force_new_token whether or not to force obtaining a new oAuth token - * @param boolean $cache_response whether or not to cache the response irrespective of the response code. + * @param boolean $cache_fail_response whether or not to cache the api response even if it's failed * * @return mixed the return data from the call of false if a failure occurred */ - protected function send_request( $url, $method = 'GET', $data = array(), $force_new_token = false, $cache_response = false ) { + protected function send_request( $url, $method = 'GET', $data = array(), $force_new_token = false, $cache_fail_response = false ) { $method = strtoupper( sanitize_text_field( $method ) ); @@ -219,7 +219,7 @@ protected function send_request( $url, $method = 'GET', $data = array(), $force_ switch ( $method ) { case 'GET': - $request = $this->cached_get( $url, $args, $cache_response ); + $request = $this->cached_get( $url, $args, $cache_fail_response ); break;